1 <!doctype linuxdoc system> <!-- -*- text-mode -*- -->
4 <title>cc65 function reference
5 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
6 <url url="mailto:greg.king5@verizon.net" name="Greg King">
10 cc65 is a C compiler for 6502 based systems. This function reference describes
11 the C functions available in the standard library.
14 <!-- Table of contents -->
17 <!-- Begin the document -->
21 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
22 C standard plus additional functions specially crafted for 6502 systems or
23 just some of the supported machines. This function refrence describes the
24 available functions together with any limitations.
26 For an overview about the available libraries, their purpose, and any
27 differences to the ISO standard, please have a look at the <url
28 url="library.html" name="cc65 Library Overview">.
30 <em/Note:/ Standard C functions are listed here, but not described in detail.
31 Since these functions behave identical on all standard compliant systems, they
32 are described in any book covering standard C.
34 Each entry for a function contains a detailed description
38 <tag/Function/Summary of what <bf/function/ does.
39 <tag/Header/The header file that contains the declaration.
40 <tag/Declaration/Describes the needed header files and declaration of the
42 <tag/Description/Description of the function.
43 <tag/Notes/Notes on the function.
44 <tag/Availability/The availability of the function.
45 <tag/See also/Other related functions.
46 <tag/Example/A piece of actual code using the function.
51 <sect>Functions by header file<p>
53 <sect1><tt/6502.h/<label id="6502.h"><p>
56 <item><ref id="BRK" name="BRK">
57 <item><ref id="CLI" name="CLI">
58 <item><ref id="SEI" name="SEI">
59 <item><ref id="_sys" name="_sys">
60 <item><ref id="getcpu" name="getcpu">
61 <item><ref id="reset_brk" name="reset_brk">
62 <item><ref id="reset_irq" name="reset_irq">
63 <item><ref id="set_brk" name="set_brk">
64 <item><ref id="set_irq" name="set_irq">
68 <sect1><tt/accelerator.h/<label id="accelerator.h"><p>
71 <item><ref id="detect_c128" name="detect_c128">
72 <item><ref id="detect_c64dtv" name="detect_c64dtv">
73 <item><ref id="detect_c65" name="detect_c65">
74 <item><ref id="detect_chameleon" name="detect_chameleon">
75 <item><ref id="detect_scpu" name="detect_scpu">
76 <item><ref id="detect_turbomaster" name="detect_turbomaster">
77 <item><ref id="get_c128_speed" name="get_c128_speed">
78 <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed">
79 <item><ref id="get_c65_speed" name="get_c65_speed">
80 <item><ref id="get_chameleon_speed" name="get_chameleon_speed">
81 <item><ref id="get_scpu_speed" name="get_scpu_speed">
82 <item><ref id="get_turbomaster_speed" name="get_turbomaster_speed">
83 <item><ref id="set_c128_speed" name="set_c128_speed">
84 <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed">
85 <item><ref id="set_c65_speed" name="set_c65_speed">
86 <item><ref id="set_chameleon_speed" name="set_chameleon_speed">
87 <item><ref id="set_scpu_speed" name="set_scpu_speed">
88 <item><ref id="set_turbomaster_speed" name="set_turbomaster_speed">
92 <sect1><tt/apple2.h/<label id="apple2.h"><p>
96 <item><ref id="get_ostype" name="get_ostype">
101 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
105 <item><ref id="get_ostype" name="get_ostype">
106 <item>rebootafterexit
109 <item><ref id="videomode" name="videomode">
113 <sect1><tt/assert.h/<label id="assert.h"><p>
116 <item><ref id="assert" name="assert">
120 <sect1><tt/atari.h/<label id="atari.h"><p>
123 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
124 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
125 <!-- <item><ref id="_graphics" name="_graphics"> -->
126 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
127 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
128 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
129 <!-- <item><ref id="_scroll" name="_scroll"> -->
130 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
131 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
132 <item><ref id="get_ostype" name="get_ostype">
133 <!-- <item><ref id="get_tv" name="get_tv"> -->
139 <sect1><tt/atmos.h/<label id="atmos.h"><p>
142 <item><ref id="atmos_explode" name="atmos_explode">
143 <item><ref id="atmos_load" name="atmos_load">
144 <item><ref id="atmos_ping" name="atmos_ping">
145 <item><ref id="atmos_save" name="atmos_save">
146 <item><ref id="atmos_shoot" name="atmos_shoot">
147 <item><ref id="atmos_tick" name="atmos_tick">
148 <item><ref id="atmos_tock" name="atmos_tock">
149 <item><ref id="atmos_zap" name="atmos_zap">
153 <sect1><tt/c128.h/<label id="c128.h"><p>
156 <item><ref id="c64mode" name="c64mode">
157 <item><ref id="fast" name="fast">
158 <item><ref id="isfast" name="isfast">
159 <item><ref id="slow" name="slow">
160 <item><ref id="toggle_videomode" name="toggle_videomode">
161 <item><ref id="videomode" name="videomode">
165 <sect1><tt/c16.h/<label id="c16.h"><p>
168 <item><ref id="fast" name="fast">
169 <item><ref id="isfast" name="isfast">
170 <item><ref id="slow" name="slow">
176 <sect1><tt/c64.h/<label id="c64.h"><p>
179 <item><ref id="get_ostype" name="get_ostype">
183 <sect1><tt/cbm.h/<label id="cbm.h"><p>
186 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
187 <item><ref id="cbm_k_basin" name="cbm_k_basin">
188 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
189 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
190 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
191 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
192 <item><ref id="cbm_k_clall" name="cbm_k_clall">
193 <item><ref id="cbm_k_close" name="cbm_k_close">
194 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
195 <item><ref id="cbm_k_getin" name="cbm_k_getin">
196 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
197 <item><ref id="cbm_k_listen" name="cbm_k_listen">
198 <item><ref id="cbm_k_load" name="cbm_k_load">
199 <item><ref id="cbm_k_open" name="cbm_k_open">
200 <item><ref id="cbm_k_readst" name="cbm_k_readst">
201 <item><ref id="cbm_k_save" name="cbm_k_save">
202 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
203 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
204 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
205 <item><ref id="cbm_k_talk" name="cbm_k_talk">
206 <item><ref id="cbm_k_tksa" name="cbm_k_tksa">
207 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
208 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
209 <item><ref id="cbm_k_untlk" name="cbm_k_untlk">
210 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
211 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
212 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
213 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
214 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
215 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
216 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
217 <!-- <item><ref id="get_tv" name="get_tv"> -->
218 <item><ref id="waitvsync" name="waitvsync">
219 <item><ref id="kbrepeat" name="kbrepeat">
225 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
228 <item><ref id="peekbsys" name="peekbsys">
229 <item><ref id="peekwsys" name="peekwsys">
230 <item><ref id="pokebsys" name="pokebsys">
231 <item><ref id="pokewsys" name="pokewsys">
235 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
238 <item><ref id="peekbsys" name="peekbsys">
239 <item><ref id="peekwsys" name="peekwsys">
240 <item><ref id="pokebsys" name="pokebsys">
241 <item><ref id="pokewsys" name="pokewsys">
245 <sect1><tt/cc65.h/<label id="cc65.h"><p>
248 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
249 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
250 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
251 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
252 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
253 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
254 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
255 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
256 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
257 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
263 <sect1><tt/conio.h/<label id="conio.h"><p>
266 <item><ref id="bgcolor" name="bgcolor">
267 <item><ref id="bordercolor" name="bordercolor">
268 <item><ref id="cclear" name="cclear">
269 <item><ref id="cclearxy" name="cclearxy">
270 <item><ref id="cgetc" name="cgetc">
271 <item><ref id="chline" name="chline">
272 <item><ref id="chlinexy" name="chlinexy">
273 <item><ref id="clrscr" name="clrscr">
274 <item><ref id="cpeekc" name="cpeekc">
275 <item><ref id="cpeekcolor" name="cpeekcolor">
276 <item><ref id="cpeekrevers" name="cpeekrevers">
277 <item><ref id="cpeeks" name="cpeeks">
278 <item><ref id="cprintf" name="cprintf">
279 <item><ref id="cputc" name="cputc">
280 <item><ref id="cputcxy" name="cputcxy">
281 <item><ref id="cputs" name="cputs">
282 <item><ref id="cputsxy" name="cputsxy">
283 <item><ref id="cursor" name="cursor">
284 <item><ref id="cvline" name="cvline">
285 <item><ref id="cvlinexy" name="cvlinexy">
286 <item><ref id="gotox" name="gotox">
287 <item><ref id="gotoxy" name="gotoxy">
288 <item><ref id="gotoy" name="gotoy">
289 <item><ref id="kbhit" name="kbhit">
290 <item><ref id="revers" name="revers">
291 <item><ref id="screensize" name="screensize">
292 <item><ref id="textcolor" name="textcolor">
293 <item><ref id="vcprintf" name="vcprintf">
294 <item><ref id="wherex" name="wherex">
295 <item><ref id="wherey" name="wherey">
299 <sect1><tt/ctype.h/<label id="ctype.h"><p>
302 <item><ref id="isalnum" name="isalnum">
303 <item><ref id="isalpha" name="isalpha">
304 <item><ref id="isascii" name="isascii">
305 <item><ref id="isblank" name="isblank">
306 <item><ref id="iscntrl" name="iscntrl">
307 <item><ref id="isdigit" name="isdigit">
308 <item><ref id="isgraph" name="isgraph">
309 <item><ref id="islower" name="islower">
310 <item><ref id="isprint" name="isprint">
311 <item><ref id="ispunct" name="ispunct">
312 <item><ref id="isspace" name="isspace">
313 <item><ref id="isupper" name="isupper">
314 <item><ref id="isxdigit" name="isxdigit">
315 <item><ref id="tolower" name="tolower">
316 <item><ref id="toupper" name="toupper">
320 <sect1><tt/dbg.h/<label id="dbg.h"><p>
323 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
329 <sect1><tt/device.h/<label id="device.h"><p>
332 <item><ref id="getcurrentdevice" name="getcurrentdevice">
333 <item><ref id="getdevicedir" name="getdevicedir">
334 <item><ref id="getfirstdevice" name="getfirstdevice">
335 <item><ref id="getnextdevice" name="getnextdevice">
339 <sect1><tt/dio.h/<label id="dio.h"><p>
341 <url url="dio.html" name="Low-level disk I/O API">.
344 <sect1><tt/dirent.h/<label id="dirent.h"><p>
347 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
348 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
349 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
350 <item><ref id="_DE_ISREG" name="_DE_ISREG">
351 <item><ref id="closedir" name="closedir">
352 <item><ref id="opendir" name="opendir">
353 <item><ref id="readdir" name="readdir">
354 <item><ref id="rewinddir" name="rewinddir">
355 <item><ref id="seekdir" name="seekdir">
356 <item><ref id="telldir" name="telldir">
360 <sect1><tt/em.h/<label id="em.h"><p>
362 This header file contains definitions for extended memory access,
363 see also <tt>testcode/lib/em-test.c</tt> and <tt>samples/multidemo.c</tt>.
366 <item><ref id="em_commit" name="em_commit">
367 <item><ref id="em_copyfrom" name="em_copyfrom">
368 <item><ref id="em_copyto" name="em_copyto">
369 <item><ref id="em_install" name="em_install">
370 <item><ref id="em_load_driver" name="em_load_driver">
371 <item><ref id="em_map" name="em_map">
372 <item><ref id="em_pagecount" name="em_pagecount">
373 <item><ref id="em_uninstall" name="em_uninstall">
374 <item><ref id="em_unload" name="em_unload">
375 <item><ref id="em_use" name="em_use">
379 <sect1><tt/errno.h/<label id="errno.h"><p>
382 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
383 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
384 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
385 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
391 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
394 <item><ref id="close" name="close">
395 <item><ref id="creat" name="creat">
396 <item><ref id="open" name="open">
400 <sect1><tt/gamate.h/<label id="gamate.h"><p>
403 <!-- <item><ref id="get_tv" name="get_tv"> -->
404 <item><ref id="waitvsync" name="waitvsync">
410 <sect1><tt/geos.h/<label id="geos.h"><p>
412 <url url="geos.html" name="GEOS API">.
415 <sect1><tt/joystick.h/<label id="joystick.h"><p>
418 <item><ref id="joy_count" name="joy_count">
419 <item><ref id="joy_install" name="joy_install">
420 <item><ref id="joy_load_driver" name="joy_load_driver">
421 <item><ref id="joy_read" name="joy_read">
422 <item><ref id="joy_uninstall" name="joy_uninstall">
423 <item><ref id="joy_unload" name="joy_unload">
427 <sect1><tt/locale.h/<label id="locale.h"><p>
430 <item><ref id="localeconv" name="localeconv">
431 <item><ref id="setlocale" name="setlocale">
435 <sect1><tt/lynx.h/<label id="lynx.h"><p>
438 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
439 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
440 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
441 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
442 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
443 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
444 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
450 <sect1><tt/lz4.h/<label id="lz4.h"><p>
453 <item><ref id="decompress_lz4" name="decompress_lz4">
457 <sect1><tt/modload.h/<label id="modload.h"><p>
460 <item><ref id="mod_load" name="mod_load">
461 <item><ref id="mod_free" name="mod_free">
465 <sect1><tt/mouse.h/<label id="mouse.h"><p>
468 <item><ref id="mouse_buttons" name="mouse_buttons">
469 <item><ref id="mouse_getbox" name="mouse_getbox">
470 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
471 <item><ref id="mouse_hide" name="mouse_hide">
472 <item><ref id="mouse_info" name="mouse_info">
473 <item><ref id="mouse_install" name="mouse_install">
474 <item><ref id="mouse_ioctl" name="mouse_ioctl">
475 <item><ref id="mouse_load_driver" name="mouse_load_driver">
476 <item><ref id="mouse_move" name="mouse_move">
477 <item><ref id="mouse_pos" name="mouse_pos">
478 <item><ref id="mouse_setbox" name="mouse_setbox">
479 <item><ref id="mouse_show" name="mouse_show">
480 <item><ref id="mouse_uninstall" name="mouse_uninstall">
481 <item><ref id="mouse_unload" name="mouse_unload">
485 <sect1><tt/nes.h/<label id="nes.h"><p>
488 <!-- <item><ref id="get_tv" name="get_tv"> -->
489 <item><ref id="waitvsync" name="waitvsync">
495 <sect1><tt/o65.h/<label id="o65.h"><p>
497 The <tt/o65.h/ header file contains structure and constant definitions that
498 may be used when dealing with files in <url
499 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
500 It does not declare any functions.
503 <sect1><tt/pce.h/<label id="pce.h"><p>
506 <!-- <item><ref id="get_tv" name="get_tv"> -->
507 <item><ref id="waitvsync" name="waitvsync">
513 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
516 <item><ref id="PEEK" name="PEEK">
517 <item><ref id="PEEKW" name="PEEKW">
518 <item><ref id="POKE" name="POKE">
519 <item><ref id="POKEW" name="POKEW">
523 <sect1><tt/pen.h/<label id="pen.h"><p>
526 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
527 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
533 <sect1><tt/pet.h/<label id="pet.h"><p>
538 <sect1><tt/plus4.h/<label id="plus4.h"><p>
541 <item><ref id="fast" name="fast">
542 <item><ref id="isfast" name="isfast">
543 <item><ref id="slow" name="slow">
549 <sect1><tt/serial.h/<label id="serial.h"><p>
551 This header file contains definitions for initializing serial
552 communication, see also <tt>testcode/lib/ser-test.c</tt>.
555 <item><ref id="ser_close" name="ser_close">
556 <item><ref id="ser_get" name="ser_get">
557 <item><ref id="ser_install" name="ser_install">
558 <item><ref id="ser_ioctl" name="ser_ioctl">
559 <item><ref id="ser_load_driver" name="ser_load_driver">
560 <item><ref id="ser_open" name="ser_open">
561 <item><ref id="ser_put" name="ser_put">
562 <item><ref id="ser_status" name="ser_status">
563 <item><ref id="ser_uninstall" name="ser_uninstall">
564 <item><ref id="ser_unload" name="ser_unload">
568 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
571 <item><ref id="setjmp" name="setjmp">
572 <item><ref id="longjmp" name="longjmp">
576 <sect1><tt/signal.h/<label id="signal.h"><p>
579 <item><ref id="raise" name="raise">
580 <item><ref id="signal" name="signal">
584 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
589 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
594 <sect1><tt/stddef.h/<label id="stddef.h"><p>
597 <item><ref id="offsetof" name="offsetof">
601 <sect1><tt/stdio.h/<label id="stdio.h"><p>
604 <item><ref id="_poserror" name="_poserror">
605 <item><ref id="clearerr" name="clearerr">
606 <!-- <item><ref id="fclose" name="fclose"> -->
607 <!-- <item><ref id="fdopen" name="fdopen"> -->
608 <item><ref id="feof" name="feof">
609 <item><ref id="ferror" name="ferror">
610 <!-- <item><ref id="fflush" name="fflush"> -->
611 <!-- <item><ref id="fgetc" name="fgetc"> -->
612 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
613 <!-- <item><ref id="fgets" name="fgets"> -->
614 <item><ref id="fileno" name="fileno">
615 <!-- <item><ref id="fopen" name="fopen"> -->
616 <!-- <item><ref id="fprintf" name="fprintf"> -->
617 <!-- <item><ref id="fputc" name="fputc"> -->
618 <!-- <item><ref id="fputs" name="fputs"> -->
619 <!-- <item><ref id="fread" name="fread"> -->
620 <!-- <item><ref id="freopen" name="freopen"> -->
621 <!-- <item><ref id="fscanf" name="fscanf"> -->
622 <!-- <item><ref id="fseek" name="fseek"> -->
623 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
624 <!-- <item><ref id="ftell" name="ftell"> -->
625 <!-- <item><ref id="fwrite" name="fwrite"> -->
626 <!-- <item><ref id="getc" name="getc"> -->
627 <!-- <item><ref id="getchar" name="getchar"> -->
628 <!-- <item><ref id="gets" name="gets"> -->
629 <!-- <item><ref id="printf" name="printf"> -->
630 <!-- <item><ref id="putc" name="putc"> -->
631 <!-- <item><ref id="putchar" name="putchar"> -->
632 <!-- <item><ref id="puts" name="puts"> -->
633 <item><ref id="rename" name="rename">
634 <item><ref id="remove" name="remove">
635 <!-- <item><ref id="rewind" name="rewind"> -->
636 <!-- <item><ref id="scanf" name="scanf"> -->
637 <!-- <item><ref id="snprintf" name="snprintf"> -->
638 <!-- <item><ref id="sprintf" name="sprintf"> -->
639 <!-- <item><ref id="sscanf" name="sscanf"> -->
640 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
641 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
642 <!-- <item><ref id="vprintf" name="vprintf"> -->
643 <!-- <item><ref id="vscanf" name="vscanf"> -->
644 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
645 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
646 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
652 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
655 <item><ref id="_heapadd" name="_heapadd">
656 <item><ref id="_heapblocksize" name="_heapblocksize">
657 <item><ref id="_heapmaxavail" name="_heapmaxavail">
658 <item><ref id="_heapmemavail" name="_heapmemavail">
659 <item><ref id="_randomize" name="_randomize">
660 <item><ref id="_swap" name="_swap">
661 <item><ref id="abort" name="abort">
662 <item><ref id="abs" name="abs">
663 <item><ref id="atexit" name="atexit">
664 <item><ref id="atoi" name="atoi">
665 <item><ref id="atol" name="atol">
666 <item><ref id="bsearch" name="bsearch">
667 <item><ref id="calloc" name="calloc">
668 <item><ref id="div" name="div">
669 <item><ref id="exit" name="exit">
670 <item><ref id="free" name="free">
671 <item><ref id="getenv" name="getenv">
672 <item><ref id="itoa" name="itoa">
673 <item><ref id="labs" name="labs">
674 <item><ref id="ltoa" name="ltoa">
675 <item><ref id="malloc" name="malloc">
676 <item><ref id="perror" name="perror">
677 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
678 <!-- <item><ref id="putenv" name="putenv"> -->
679 <item><ref id="qsort" name="qsort">
680 <item><ref id="rand" name="rand">
681 <item><ref id="realloc" name="realloc">
682 <item><ref id="srand" name="srand">
683 <!-- <item><ref id="system" name="system"> -->
684 <item><ref id="ultoa" name="ultoa">
685 <item><ref id="utoa" name="utoa">
691 <sect1><tt/string.h/<label id="string.h"><p>
694 <item><ref id="_stroserror" name="_stroserror">
695 <item><ref id="bzero" name="bzero">
696 <item><ref id="memchr" name="memchr">
697 <item><ref id="memcmp" name="memcmp">
698 <item><ref id="memcpy" name="memcpy">
699 <item><ref id="memmove" name="memmove">
700 <item><ref id="memset" name="memset">
701 <item><ref id="strcasecmp" name="strcasecmp">
702 <item><ref id="strcat" name="strcat">
703 <item><ref id="strchr" name="strchr">
704 <item><ref id="strcmp" name="strcmp">
705 <item><ref id="strcoll" name="strcoll">
706 <item><ref id="strcpy" name="strcpy">
707 <item><ref id="strcspn" name="strcspn">
708 <item><ref id="strdup" name="strdup">
709 <item><ref id="strerror" name="strerror">
710 <item><ref id="stricmp" name="stricmp">
711 <item><ref id="strlen" name="strlen">
712 <item><ref id="strlower" name="strlower">
713 <item><ref id="strlwr" name="strlwr">
714 <item><ref id="strncasecmp" name="strncasecmp">
715 <item><ref id="strncat" name="strncat">
716 <item><ref id="strncmp" name="strncmp">
717 <item><ref id="strncpy" name="strncpy">
718 <item><ref id="strnicmp" name="strnicmp">
719 <item><ref id="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>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2231 <tag/Function/Set up a logical file
2232 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2233 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2234 <tag/Description/This functions sets up the logical file by setting its number, device address,
2235 and secondary address.
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.
2240 <tag/Availability/cc65
2242 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2248 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2252 <tag/Function/Set Filename Parameters
2253 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2254 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2255 <tag/Description/This function is used to set up the file name for the OPEN,
2256 SAVE, or LOAD operations.
2257 <tag/Notes/<itemize>
2258 <item>The function is only available as fastcall function, so it may
2259 only be used in presence of a prototype.
2261 <tag/Availability/cc65
2263 <ref id="cbm_k_open" name="cbm_k_open">,
2264 <ref id="cbm_k_load" name="cbm_k_load">,
2265 <ref id="cbm_k_save" name="cbm_k_save">
2271 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2275 <tag/Function/Commands device to TALK
2276 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2277 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2278 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2279 bus. This commands the device to TALK.
2280 <tag/Notes/<itemize>
2281 <item>The function is only available as fastcall function, so it may
2282 only be used in presence of a prototype.
2284 <tag/Availability/cc65
2286 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2292 <sect1>cbm_k_tksa<label id="cbm_k_tksa"><p>
2296 <tag/Function/Send TALK secondary address to serial bus
2297 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2298 <tag/Declaration/<tt/void __fastcall__ cbm_k_tksa (unsigned char addr);/
2299 <tag/Description/This function transmits a secondary address on the serial bus for a TALK device.
2300 <tag/Notes/<itemize>
2301 <item>The function is only available as fastcall function, so it may
2302 only be used in presence of a prototype.
2303 <item>The function can only be called after a call to TALK.
2304 <item>The function will not work after a LISTEN.
2306 <tag/Availability/cc65
2308 <ref id="cbm_k_talk" name="cbm_k_talk">
2314 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2318 <tag/Function/Update the Jiffy clock.
2319 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2320 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2321 <tag/Description/This function adds one count to the Jiffy clock. That clock
2322 counts sixtieths of a second. It is used by the library's <tt/clock()/
2323 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2324 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2325 then that ISR must call this function, in order to keep the clock valid.
2326 <tag/Availability/cc65
2328 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2329 <ref id="clock" name="clock">
2335 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2339 <tag/Function/Send an UNLISTEN command
2340 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2341 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2342 <tag/Description/This function commands all devices on the serial bus to
2343 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2344 function results in an UNLISTEN command being transmitted on the serial
2345 bus. Only devices previously commanded to LISTEN are affected. This
2346 function is normally used after the host computer is finished sending data
2347 to external devices. Sending the UNLISTEN commands the listening devices
2348 to get off the serial bus so it can be used for other purposes.
2349 <tag/Availability/cc65
2351 <ref id="cbm_k_listen" name="cbm_k_listen">
2357 <sect1>cbm_k_untlk<label id="cbm_k_untlk"><p>
2361 <tag/Function/Send an UNTALK command
2362 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2363 <tag/Declaration/<tt/void cbm_k_untlk (void);/
2364 <tag/Description/This function commands all devices on the serial bus to
2365 stop sending data to the host computer (i.e., UNTALK). Calling this
2366 function results in an UNTALK command being transmitted on the serial
2367 bus. Only devices previously commanded to TALK are affected. This
2368 function is normally used after the host computer is finished listening to data
2369 from an external device. Sending the UNTALK commands the sending devices
2370 to get off the serial bus so it can be used for other purposes.
2371 <tag/Availability/cc65
2373 <ref id="cbm_k_talk" name="cbm_k_talk">
2379 <sect1>cclear<label id="cclear"><p>
2383 <tag/Function/Clear part of a line (write a given number of spaces).
2384 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2385 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2386 <tag/Description/The function clears part of a line by writing <tt/length/
2387 spaces in the current text color.
2388 <tag/Notes/<itemize>
2389 <item>The function is only available as fastcall function, so it may
2390 only be used in presence of a prototype.
2392 <tag/Availability/cc65
2394 <ref id="cclearxy" name="cclearxy">,
2395 <ref id="clrscr" name="clrscr">
2401 <sect1>cclearxy<label id="cclearxy"><p>
2405 <tag/Function/Clear part of a line (write a given number of spaces) starting
2406 at a specific screen position.
2407 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2408 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2409 <tag/Description/The function moves the cursor to a specific position, and
2410 will then clear part of the line by writing <tt/length/ spaces in the current
2412 <tag/Notes/<itemize>
2413 <item>The function is only available as fastcall function, so it may
2414 only be used in presence of a prototype.
2416 <tag/Availability/cc65
2418 <ref id="cclear" name="cclear">,
2419 <ref id="clrscr" name="clrscr">
2425 <sect1>cgetc<label id="cgetc"><p>
2429 <tag/Function/Read a character from the keyboard.
2430 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2431 <tag/Declaration/<tt/char cgetc (void);/
2432 <tag/Description/The function reads a character from the keyboard. If there is
2433 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2434 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2435 displayed while waiting.
2436 <tag/Notes/<itemize>
2437 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2438 from that buffer; and, wait only if the buffer is empty.
2439 <item>The keyboard must be scanned periodically, in order for this function to
2440 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2442 <tag/Availability/cc65
2444 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2445 <ref id="cursor" name="cursor">,
2446 <ref id="kbhit" name="kbhit">
2452 <sect1>chline<label id="chline"><p>
2456 <tag/Function/Output a horizontal line in text mode.
2457 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2458 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2459 <tag/Description/The function outputs a horizontal line with the given length
2460 starting at the current cursor position.
2461 <tag/Notes/<itemize>
2462 <item>The character used to draw the horizontal line is system dependent.
2463 If available, a line drawing character is used. Drawing a line that is partially
2464 off screen leads to undefined behaviour.
2465 <item>The function is only available as fastcall function, so it may only be
2466 used in presence of a prototype.
2468 <tag/Availability/cc65
2470 <ref id="chlinexy" name="chlinexy">,
2471 <ref id="cvline" name="cvline">,
2472 <ref id="cvlinexy" name="cvlinexy">
2478 <sect1>chlinexy<label id="chlinexy"><p>
2482 <tag/Function/Output a horizontal line at a given position in text mode.
2483 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2484 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2485 <tag/Description/The function outputs a horizontal line with the given length
2486 starting at a given position.
2487 <tag/Notes/<itemize>
2488 <item>The character used to draw the horizontal line is system dependent.
2489 If available, a line drawing character is used. Drawing a line that is partially
2490 off screen leads to undefined behaviour.
2491 <item>The function is only available as fastcall function, so it may only be
2492 used in presence of a prototype.
2494 <tag/Availability/cc65
2496 <ref id="chline" name="chline">,
2497 <ref id="cvline" name="cvline">,
2498 <ref id="cvlinexy" name="cvlinexy">
2504 <sect1>clearerr<label id="clearerr"><p>
2508 <tag/Function/Clear error and end-of-file status of a stream.
2509 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2510 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2511 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2512 indicators for the stream <tt/f/.
2513 <tag/Notes/<itemize>
2514 <item>The function is only available as fastcall function, so it may only be
2515 used in presence of a prototype.
2517 <tag/Availability/ISO 9899
2519 <ref id="feof" name="feof">,
2520 <ref id="ferror" name="ferror">
2526 <sect1>clock<label id="clock"><p>
2530 <tag/Function/Determine the processor time used.
2531 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2532 <tag/Declaration/<tt/clock_t clock (void);/
2533 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2534 time used by the program. The time is returned in implementation-defined
2535 units. It can be converted to seconds by dividing by the value of the macro
2536 <tt/CLOCKS_PER_SEC/.
2537 <tag/Notes/<itemize>
2538 <item>Since the machines that cc65-generated programs run on cannot run multiple
2539 processes, the function actually will return the time since some
2540 implementation-defined point in the past.
2541 <item>The Jiffy clock must be "running", in order for this function to return
2542 changing values. (See the description of <tt/cbm_k_udtim()/.)
2544 <tag/Availability/ISO 9899
2546 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2547 <ref id="time" name="time">
2553 <sect1>clrscr<label id="clrscr"><p>
2557 <tag/Function/Clear the text screen.
2558 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2559 <tag/Declaration/<tt/void clrscr (void);/
2560 <tag/Description/The function clears the text screen and moves the cursor to
2561 the upper left corner.
2562 <tag/Availability/cc65
2564 <ref id="cclear" name="cclear">,
2565 <ref id="cclearxy" name="cclearxy">
2571 <sect1>close<label id="close"><p>
2575 <tag/Function/Close a file descriptor.
2576 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2577 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2578 <tag/Description/The function closes the given file descriptor. It returns zero
2579 on success and -1 on error. If an error occurs, the cause can be determined by
2580 reading the <tt/errno/ variable.
2581 <tag/Notes/<itemize>
2582 <item>The function is only available as fastcall function, so it may only
2583 be used in presence of a prototype.
2585 <tag/Availability/POSIX 1003.1
2587 <ref id="creat" name="creat">,
2588 <ref id="open" name="open">
2594 <sect1>closedir<label id="closedir"><p>
2598 <tag/Function/Close a directory.
2599 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2600 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2601 <tag/Description/The function closes the given directory descriptor. It returns
2602 zero on success and -1 on error. If an error occurs, the cause can be determined
2603 by reading the <tt/errno/ variable.
2604 <tag/Notes/<itemize>
2605 <item>The function is only available as fastcall function, so it may only
2606 be used in presence of a prototype.
2608 <tag/Availability/POSIX 1003.1
2610 <ref id="opendir" name="opendir">,
2611 <ref id="readdir" name="readdir">
2617 <sect1>cpeekc<label id="cpeekc"><p>
2621 <tag/Function/Get a character from the display memory.
2622 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2623 <tag/Declaration/<tt/char cpeekc (void);/
2624 <tag/Description/The function gets the character that's at the current location
2625 of the cursor in the display screen RAM. That character is converted, if
2626 needed, into the encoding that can be passed to <tt/cputc()/.
2627 <tag/Notes/<itemize>
2628 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2629 done to make it obvious that peeking doesn't move the cursor in any way. Your
2630 program must place the cursor where it wants to peek before it calls any of
2633 <tag/Availability/cc65
2635 <ref id="cpeekcolor" name="cpeekcolor">,
2636 <ref id="cpeekrevers" name="cpeekrevers">,
2637 <ref id="cpeeks" name="cpeeks">,
2638 <ref id="cputc" name="cputc">
2644 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2648 <tag/Function/Get a color from the display memory.
2649 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2650 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2651 <tag/Description/The function gets the color number that's at the current
2652 location of the cursor in the display screen RAM. That number can be passed to
2654 <tag/Notes/<itemize>
2655 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2656 done to make it obvious that peeking doesn't move the cursor in any way. Your
2657 program must place the cursor where it wants to peek before it calls any of
2660 <tag/Availability/cc65
2662 <ref id="cpeekc" name="cpeekc">,
2663 <ref id="cpeekrevers" name="cpeekrevers">,
2664 <ref id="cpeeks" name="cpeeks">,
2665 <ref id="cputc" name="cputc">,
2666 <ref id="textcolor" name="textcolor">
2672 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2676 <tag/Function/Get a reverse-character attribute from the display memory.
2677 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2678 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2679 <tag/Description/The function gets the "reverse-mode" attribute of the
2680 character that's at the current location of the cursor in the display screen
2681 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2682 <tag/Notes/<itemize>
2683 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2684 done to make it obvious that peeking doesn't move the cursor in any way. Your
2685 program must place the cursor where it wants to peek before it calls any of
2688 <tag/Availability/cc65
2690 <ref id="cpeekc" name="cpeekc">,
2691 <ref id="cpeekcolor" name="cpeekcolor">,
2692 <ref id="cpeeks" name="cpeeks">,
2693 <ref id="cputc" name="cputc">,
2694 <ref id="revers" name="revers">
2700 <sect1>cpeeks<label id="cpeeks"><p>
2704 <tag/Function/Get a string from the display memory.
2705 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2706 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2707 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2708 characters that start at the current location of the cursor in the display
2709 screen RAM. Those characters are converted, if needed, into the encoding that
2710 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2711 that's large enough to hold "length + 1" bytes.
2712 <tag/Notes/<itemize>
2713 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2714 done to make it obvious that peeking doesn't move the cursor in any way. Your
2715 program must place the cursor where it wants to peek before it calls any of
2717 <item>The function is available as only a fastcall function;
2718 so, it may be used only in the presence of a prototype.
2720 <tag/Availability/cc65
2722 <ref id="cpeekc" name="cpeekc">,
2723 <ref id="cpeekcolor" name="cpeekcolor">,
2724 <ref id="cpeekrevers" name="cpeekrevers">,
2725 <ref id="cputc" name="cputc">,
2726 <ref id="cputs" name="cputs">
2732 <sect1>creat<label id="creat"><p>
2736 <tag/Function/Create a file.
2737 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2738 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2739 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2740 associated with it. On error, -1 is returned and an error code is stored in
2742 <tag/Notes/<itemize>
2743 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2744 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2745 <item>The function is only available as fastcall function, so it may only
2746 be used in presence of a prototype.
2748 <tag/Availability/POSIX 1003.1
2750 <ref id="close" name="close">,
2751 <ref id="open" name="open">
2757 <sect1>cprintf<label id="cprintf"><p>
2761 <tag/Function/Formatted output to the console.
2762 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2763 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2764 <tag/Description/The arguments are converted to text where necessary and
2765 formatted according to the format string given. The resulting string is output
2766 to the console. <tt/cprintf/ supports the same format specifiers as
2767 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2768 <tag/Notes/<itemize>
2769 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2770 between <tt/\r/ and <tt/\n/.
2772 <tag/Availability/cc65
2774 <ref id="cputc" name="cputc">,
2775 <ref id="cputcxy" name="cputcxy">,
2776 <ref id="cputs" name="cputs">,
2777 <ref id="cputsxy" name="cputsxy">,
2778 <ref id="vcprintf" name="vcprintf">
2784 <sect1>cputc<label id="cputc"><p>
2788 <tag/Function/Output a character directly to the console.
2789 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2790 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2791 <tag/Description/Output one character to the console at the current cursor
2793 <tag/Notes/<itemize>
2794 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2795 between <tt/\r/ and <tt/\n/.
2796 <item>The function is only available as fastcall function, so it may only
2797 be used in presence of a prototype.
2799 <tag/Availability/cc65
2801 <ref id="cprintf" name="cprintf">,
2802 <ref id="cputcxy" name="cputcxy">,
2803 <ref id="cputs" name="cputs">,
2804 <ref id="cputsxy" name="cputsxy">,
2805 <ref id="vcprintf" name="vcprintf">
2811 <sect1>cputcxy<label id="cputcxy"><p>
2815 <tag/Function/Output a character at a specific screen position.
2816 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2817 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2818 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2819 the screen and outputs one character.
2820 <tag/Notes/<itemize>
2821 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2822 between <tt/\r/ and <tt/\n/.
2823 <item>The function is only available as fastcall function, so it may only
2824 be used in presence of a prototype.
2826 <tag/Availability/cc65
2828 <ref id="cprintf" name="cprintf">,
2829 <ref id="cputc" name="cputc">,
2830 <ref id="cputs" name="cputs">,
2831 <ref id="cputsxy" name="cputsxy">,
2832 <ref id="vcprintf" name="vcprintf">
2838 <sect1>cputs<label id="cputs"><p>
2842 <tag/Function/Output a string directly to the console.
2843 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2844 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2845 <tag/Description/The function outputs the given string on the console at the
2846 current cursor position.
2847 <tag/Notes/<itemize>
2848 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2849 between <tt/\r/ and <tt/\n/.
2850 <item>The function is only available as fastcall function, so it may only
2851 be used in presence of a prototype.
2853 <tag/Availability/cc65
2855 <ref id="cprintf" name="cprintf">,
2856 <ref id="cputc" name="cputc">,
2857 <ref id="cputcxy" name="cputcxy">,
2858 <ref id="cputsxy" name="cputsxy">,
2859 <ref id="vcprintf" name="vcprintf">
2865 <sect1>cputsxy<label id="cputsxy"><p>
2869 <tag/Function/Output a string to the console at a given position.
2870 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2871 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2872 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2873 and outputs the string <tt/s/.
2874 <tag/Notes/<itemize>
2875 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2876 between <tt/\r/ and <tt/\n/.
2877 <item>The function is only available as fastcall function, so it may only
2878 be used in presence of a prototype.
2880 <tag/Availability/cc65
2882 <ref id="cprintf" name="cprintf">,
2883 <ref id="cputc" name="cputc">,
2884 <ref id="cputcxy" name="cputcxy">,
2885 <ref id="cputs" name="cputs">,
2886 <ref id="vcprintf" name="vcprintf">
2892 <sect1>cursor<label id="cursor"><p>
2896 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2897 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2898 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2899 <tag/Description/If the argument to the function is non zero, a blinking cursor
2900 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2901 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2902 <tag/Notes/<itemize>
2903 <item>The function is only available as fastcall function, so it may only
2904 be used in presence of a prototype.
2906 <tag/Availability/cc65
2908 <ref id="cgetc" name="cgetc">,
2909 <ref id="kbhit" name="kbhit">
2915 <sect1>cvline<label id="cvline"><p>
2919 <tag/Function/Output a vertical line in text mode.
2920 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2921 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2922 <tag/Description/The function outputs a vertical line with the given length
2923 starting at the current cursor position.
2924 <tag/Notes/<itemize>
2925 <item>The character used to draw the vertical line is system dependent.
2926 If available, a line drawing character is used. Drawing a line that is partially
2927 off screen leads to undefined behaviour.
2928 <item>The function is only available as fastcall function, so it may only be
2929 used in presence of a prototype.
2931 <tag/Availability/cc65
2933 <ref id="chline" name="chline">,
2934 <ref id="chlinexy" name="chlinexy">,
2935 <ref id="cvlinexy" name="cvlinexy">
2941 <sect1>cvlinexy<label id="cvlinexy"><p>
2945 <tag/Function/Output a vertical line at a given position in text mode.
2946 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2947 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2948 <tag/Description/The function outputs a vertical line with the given length
2949 starting at a given position.
2950 <tag/Notes/<itemize>
2951 <item>The character used to draw the vertical line is system dependent.
2952 If available, a line drawing character is used. Drawing a line that is partially
2953 off screen leads to undefined behaviour.
2954 <item>The function is only available as fastcall function, so it may only be
2955 used in presence of a prototype.
2957 <tag/Availability/cc65
2959 <ref id="chline" name="chline">,
2960 <ref id="chlinexy" name="chlinexy">,
2961 <ref id="cvline" name="cvline">
2967 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2971 <tag/Function/Uncompress a LZ4-compressed buffer.
2972 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2973 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2974 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2975 <tag/Notes/<itemize>
2976 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2978 <tag/Availability/cc65
2984 <sect1>detect_c128<label id="detect_c128"><p>
2988 <tag/Function/Check if a C128 CPU is the current CPU.
2989 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2990 <tag/Declaration/<tt/unsigned char detect_c128 (void);/
2991 <tag/Description/The function returns a 1 if a C128 CPU is the current CPU.
2992 <tag/Notes/<itemize>
2993 <item>The function is specific to the C64 and C128.
2995 <tag/Availability/cc65 (not all platforms)
2997 <ref id="get_c128_speed" name="get_c128_speed">,
2998 <ref id="set_c128_speed" name="set_c128_speed">,
3004 <sect1>detect_c64dtv<label id="detect_c64dtv"><p>
3008 <tag/Function/Check for the presence of the C64DTV.
3009 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3010 <tag/Declaration/<tt/unsigned char detect_c64dtv (void);/
3011 <tag/Description/The function returns a 1 if a C64DTV has been detected.
3012 <tag/Notes/<itemize>
3013 <item>The function is specific to the C64.
3015 <tag/Availability/cc65 (not all platforms)
3017 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
3018 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3024 <sect1>detect_c65<label id="detect_c65"><p>
3028 <tag/Function/Check for the presence of a C65/C64DX in C64 mode.
3029 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3030 <tag/Declaration/<tt/unsigned char detect_c65 (void);/
3031 <tag/Description/The function returns a 1 if a C65/C64DX in C64 mode has been detected.
3032 <tag/Notes/<itemize>
3033 <item>The function is specific to the C64.
3035 <tag/Availability/cc65 (not all platforms)
3037 <ref id="get_c65_speed" name="get_c65_speed">,
3038 <ref id="set_c65_speed" name="set_c65_speed">,
3044 <sect1>detect_chameleon<label id="detect_chameleon"><p>
3048 <tag/Function/Check for the presence of the C64 Chameleon cartridge.
3049 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3050 <tag/Declaration/<tt/unsigned char detect_chameleon (void);/
3051 <tag/Description/The function returns a 1 if a C64 Chameleon cartridge has been detected.
3052 <tag/Notes/<itemize>
3053 <item>The function is specific to the C64.
3055 <tag/Availability/cc65 (not all platforms)
3057 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
3058 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3064 <sect1>detect_scpu<label id="detect_scpu"><p>
3068 <tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge.
3069 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3070 <tag/Declaration/<tt/unsigned char detect_scpu (void);/
3071 <tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected.
3072 <tag/Notes/<itemize>
3073 <item>The function is specific to the C128 and C64.
3075 <tag/Availability/cc65 (not all platforms)
3077 <ref id="get_scpu_speed" name="get_scpu_speed">,
3078 <ref id="set_scpu_speed" name="set_scpu_speed">,
3084 <sect1>detect_turbomaster<label id="detect_turbomaster"><p>
3088 <tag/Function/Check for the presence of the C64 Turbo Master cartridge.
3089 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3090 <tag/Declaration/<tt/unsigned char detect_turbomaster (void);/
3091 <tag/Description/The function returns a 1 if a C64 Turbo Master cartridge has been detected.
3092 <tag/Notes/<itemize>
3093 <item>The function is specific to the C64.
3095 <tag/Availability/cc65 (not all platforms)
3097 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
3098 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3104 <sect1>div<label id="div"><p>
3108 <tag/Function/Divide two ints and return quotient and remainder.
3109 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3110 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
3111 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
3112 quotient and remainder in a <tt/div_t/ structure.
3113 <tag/Notes/<itemize>
3114 <item>The function is only available as fastcall function, so it may only
3115 be used in presence of a prototype.
3117 <tag/Availability/ISO 9899
3125 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
3129 <tag/Function/Determines whether the screen is going to be cleared after program exit.
3130 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
3131 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
3132 <tag/Description/The function returns zero if the screen won't be cleared immediately after
3133 program termination. It returns a non-zero value if it will.
3134 <tag/Notes/<itemize>
3135 <item>Some systems, maybe depending on configuration, immediately clear the screen
3136 after a program exits. Therefore it might be difficult to read
3137 the last messages printed by the program prior to its exit. This function can be used
3138 to decide if a delay or wait for a key press should be executed when then program
3141 <tag/Availability/cc65
3144 #include <stdio.h>
3145 #include <unistd.h>
3146 #include <cc65.h>
3149 printf("Hello World\n");
3150 if (doesclrscrafterexit())
3159 <sect1>em_commit<label id="em_commit"><p>
3163 <tag/Function/Commit changes into extended memory.
3164 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3165 <tag/Declaration/<tt/void em_commit (void);/
3166 <tag/Description/Commit changes in the memory window to extended storage. If
3167 the contents of the memory window have been changed, these changes may be lost
3168 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
3169 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
3170 name="em_copyto">/ are called without calling <tt/em_commit/ first.
3171 <tag/Notes/<itemize>
3172 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
3173 memory window are discarded, it does just mean that the drivers is allowed
3175 <item>The function is only available as fastcall function, so it may only be
3176 used in presence of a prototype.
3177 <item>The function produces undefined results if no extended memory driver is
3180 <tag/Availability/cc65
3182 <ref id="em_load_driver" name="em_load_driver">,
3183 <ref id="em_map" name="em_map">,
3184 <ref id="em_use" name="em_use">
3190 <sect1>em_copyfrom<label id="em_copyfrom"><p>
3194 <tag/Function/Copy from extended into normal memory.
3195 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3196 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
3197 <tag/Description/Copy data from extended memory into linear memory. Source and
3198 target addresses as well as the number of bytes to transfer are specified in
3199 the <tt/em_copy/ structure that is passed as a parameter.
3200 <tag/Notes/<itemize>
3201 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
3202 made any changes to the data in the window, call <tt/<ref id="em_commit"
3203 name="em_commit">/ first, or the changes are lost.
3204 <item>The function is only available as fastcall function, so it may only be
3205 used in presence of a prototype.
3206 <item>The function produces undefined results if no extended memory driver is
3209 <tag/Availability/cc65
3211 <ref id="em_commit" name="em_commit">,
3212 <ref id="em_copyto" name="em_copyto">,
3213 <ref id="em_load_driver" name="em_load_driver">
3219 <sect1>em_copyto<label id="em_copyto"><p>
3223 <tag/Function/Copy from normal into extended memory.
3224 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3225 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3226 <tag/Description/Copy data from linear into extended memory. Source and
3227 target addresses as well as the number of bytes to transfer are specified in
3228 the <tt/em_copy/ structure that is passed as a parameter.
3229 <tag/Notes/<itemize>
3230 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3231 made any changes to the data in the window, call <tt/<ref id="em_commit"
3232 name="em_commit">/ first, or the changes are lost.
3233 <item>The function is only available as fastcall function, so it may only be
3234 used in presence of a prototype.
3235 <item>The function produces undefined results if no extended memory driver is
3238 <tag/Availability/cc65
3240 <ref id="em_commit" name="em_commit">,
3241 <ref id="em_copyfrom" name="em_copyfrom">,
3242 <ref id="em_load_driver" name="em_load_driver">
3248 <sect1>em_install<label id="em_install"><p>
3252 <tag/Function/Install an already loaded extended memory driver.
3253 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3254 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3255 <tag/Description/The function installs an already loaded extended memory driver
3256 and returns an error code. The function may be used to install a driver linked
3257 statically to the program.
3258 <tag/Notes/<itemize>
3259 <item>Not all drivers are able to detect if the supported hardware is really
3261 <item>The function is only available as fastcall function, so it may only be
3262 used in presence of a prototype.
3264 <tag/Availability/cc65
3266 <ref id="em_load_driver" name="em_load_driver">,
3267 <ref id="em_uninstall" name="em_uninstall">,
3268 <ref id="em_unload" name="em_unload">
3274 <sect1>em_load_driver<label id="em_load_driver"><p>
3278 <tag/Function/Load and initialize an extended memory driver.
3279 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3280 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3281 <tag/Description/Load an extended memory driver into memory and initialize
3282 it. The function returns an error code that tells if all this has been
3284 <tag/Notes/<itemize>
3285 <item>Not all drivers are able to detect if the supported hardware is really
3287 <item>The function is only available as fastcall function, so it may only be
3288 used in presence of a prototype.
3289 <item>The driver is loaded by name, so currently you must know the type of
3290 extended memory that should be supported. There is no autodetect capability.
3292 <tag/Availability/cc65
3294 <ref id="em_unload" name="em_unload">
3300 <sect1>em_map<label id="em_map"><p>
3304 <tag/Function/Make a page of extended memory accessible.
3305 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3306 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3307 <tag/Description/The function maps one page of extended memory into linear
3308 memory and returns a pointer to the page frame. Depending on the hardware
3309 and driver, the data is either mapped into the address space or transfered
3310 into a buffer. If you don't need the actual contents of the page (for example
3311 because you're going to overwrite it completely), it is better to call
3312 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3313 data if it is possible to avoid that.
3314 <tag/Notes/<itemize>
3315 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3316 made any changes to the data in the window, call <tt/<ref id="em_commit"
3317 name="em_commit">/ first, or the changes are lost.
3318 <item>The function is only available as fastcall function, so it may only be
3319 used in presence of a prototype.
3320 <item>The function produces undefined results if no extended memory driver is
3323 <tag/Availability/cc65
3325 <ref id="em_commit" name="em_commit">,
3326 <ref id="em_load_driver" name="em_load_driver">,
3327 <ref id="em_use" name="em_use">
3333 <sect1>em_pagecount<label id="em_pagecount"><p>
3337 <tag/Function/Return the number of available extended memory pages.
3338 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3339 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3340 <tag/Description/The function returns the size of the extended memory supported
3341 by the driver in 256 byte pages.
3342 <tag/Notes/<itemize>
3343 <item>The function returns zero if no extended memory driver is loaded.
3344 <item>The function may return zero if the supported hardware was not detected.
3346 <tag/Availability/cc65
3348 <ref id="em_load_driver" name="em_load_driver">
3354 <sect1>em_uninstall<label id="em_uninstall"><p>
3358 <tag/Function/Uninstall an already loaded extended memory driver.
3359 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3360 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3361 <tag/Description/The function uninstalls an already loaded extended memory
3362 driver but doesn't remove it from memory.
3363 <tag/Notes/<itemize>
3364 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3365 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3366 should be used instead of <tt/em_uninstall/ so the driver is also removed
3369 <tag/Availability/cc65
3371 <ref id="em_install" name="em_install">,
3372 <ref id="em_load_driver" name="em_load_driver">,
3373 <ref id="em_unload" name="em_unload">
3379 <sect1>em_unload<label id="em_unload"><p>
3383 <tag/Function/Unload an extended memory driver.
3384 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3385 <tag/Declaration/<tt/unsigned char em_unload (void);/
3386 <tag/Description/The function unloads a loaded extended memory driver and
3387 frees all memory allocated for the driver.
3388 <tag/Notes/<itemize>
3389 <item>The function does nothing if no driver is loaded.
3391 <tag/Availability/cc65
3393 <ref id="em_load_driver" name="em_load_driver">
3399 <sect1>em_use<label id="em_use"><p>
3403 <tag/Function/Prepare an extended memory page for use.
3404 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3405 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3406 <tag/Description/The function maps one page of extended memory into linear
3407 memory and returns a pointer to the page frame. This function is similar to
3408 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3409 actual memory window in the assumption that the existing data is wrong or
3410 will get overwritten.
3411 <tag/Notes/<itemize>
3412 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3413 made any changes to the data in the window, call <tt/<ref id="em_commit"
3414 name="em_commit">/ first, or the changes are lost.
3415 <item>The function is only available as fastcall function, so it may only be
3416 used in presence of a prototype.
3417 <item>The function produces undefined results if no extended memory driver is
3420 <tag/Availability/cc65
3422 <ref id="em_commit" name="em_commit">,
3423 <ref id="em_load_driver" name="em_load_driver">,
3424 <ref id="em_map" name="em_map">
3430 <sect1>exit<label id="exit"><p>
3434 <tag/Function/Terminate the program.
3435 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3436 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3437 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3438 return code of the program. Before termination, all files are closed, buffered
3439 output is written and any functions registered with <tt/<ref id="atexit"
3440 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3441 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3443 <tag/Notes/<itemize>
3444 <item>The function is only available as fastcall function, so it may only
3445 be used in presence of a prototype.
3446 <item>It depends on the host machine if the program return code can be
3447 evaluated or is ignored.
3449 <tag/Availability/ISO 9899
3451 <ref id="abort" name="abort">,
3452 <ref id="exit" name="exit">
3458 <sect1>exec<label id="exec"><p>
3462 <tag/Function/Execute a program file.
3463 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3464 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3465 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3466 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3467 then loading and starting the program named in the first argument, passing
3468 the command line specified as second argument. Instead of an empty string,
3469 a <tt/NULL/ pointer may be passed as second parameter.
3470 On success, the function does not return. On failure, -1 is returned and
3471 <tt/errno/ contains an error code.
3472 <tag/Notes/<itemize>
3473 <item>The function is only available as fastcall function, so it may only
3474 be used in presence of a prototype.
3475 <item>On most platforms, the function needs to copy a small stub loader to
3476 some memory area outside the program space. This may collide with other
3477 programs. See the platform specific docs on this.
3478 <item>Because it is necessary to terminate the running program before the
3479 memory can be reused to load the new one, there is a high chance that the
3480 function may not be able to return on errors.
3481 <item>The command line is passed to the new program in the same way as cc65
3482 programs expect the command line. If the new program is not a cc65 generated
3483 program, it may not be able to read it.
3485 <tag/Availability/cc65
3487 <ref id="exit" name="exit">
3493 <sect1>fast<label id="fast"><p>
3497 <tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
3498 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
3499 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
3500 <tag/Declaration/<tt/void fast (void);/
3501 <tag/Description/The function will switch the clock of the CPU to fast mode. For the C128
3502 target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means
3503 switching the CPU into double clock mode.
3504 <tag/Notes/<itemize>
3505 <item>The function is specific to the C128, C16 and Plus4.
3506 <item>On the C128 the 2MHz clock will not work in 40 column mode.
3508 <tag/Availability/cc65 (not all platforms)
3510 <ref id="isfast" name="isfast">,
3511 <ref id="slow" name="slow">,
3517 <sect1>feof<label id="feof"><p>
3521 <tag/Function/Return the end-of-file indicator of a stream.
3522 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3523 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3524 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3525 <tt/f/, and returns a non zero value if it is set.
3526 <tag/Notes/<itemize>
3527 <item>The indicator is set only after a read past the end of a file is
3529 <item>The function is only available as fastcall function, so it may only be
3530 used in presence of a prototype.
3532 <tag/Availability/ISO 9899
3534 <ref id="feof" name="clearerr">,
3535 <ref id="ferror" name="ferror">
3541 <sect1>ferror<label id="ferror"><p>
3545 <tag/Function/Return the error indicator of a stream.
3546 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3547 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3548 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3549 <tt/f/, and returns a non zero value if it is set.
3550 <tag/Notes/<itemize>
3551 <item>The function is only available as fastcall function, so it may only be
3552 used in presence of a prototype.
3554 <tag/Availability/ISO 9899
3556 <ref id="feof" name="clearerr">,
3557 <ref id="ferror" name="feof">
3563 <sect1>fileno<label id="fileno"><p>
3567 <tag/Function/Return the file handle used by a stream.
3568 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3569 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3570 <tag/Description/The <tt/fileno/ function returns the file handle used
3571 internally by a C stream. This file handle (an integer) can be used as a
3572 handle for the POSIX input/output functions.
3573 <tag/Notes/<itemize>
3574 <item>The function is only available as fastcall function, so it may only be
3575 used in presence of a prototype.
3576 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3577 file may have unpredictable results.
3579 <tag/Availability/POSIX 1003.1
3581 <ref id="creat" name="creat">,
3582 <ref id="open" name="open"> <!-- , -->
3583 <!-- <ref id="read" name="read">, -->
3584 <!-- <ref id="write" name="write"> -->
3590 <sect1>free<label id="free"><p>
3594 <tag/Function/Free a block of dynamic memory.
3595 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3596 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3597 <tag/Description/Free a block of dynamic memory previously allocated with
3598 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3599 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3600 pointer is <tt/NULL/, no action is performed.
3601 <tag/Notes/<itemize>
3602 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3603 behaviour and may crash your program.
3604 <item>The function is only available as fastcall function, so it may only
3605 be used in presence of a prototype.
3607 <tag/Availability/ISO 9899
3609 <ref id="_heapadd" name="_heapadd">,
3610 <ref id="_heapblocksize" name="_heapblocksize">,
3611 <ref id="_heapmaxavail" name="_heapmaxavail">,
3612 <ref id="_heapmemavail" name="_heapmemavail">,
3613 <ref id="calloc" name="calloc">,
3614 <ref id="malloc" name="malloc">,
3615 <ref id="realloc" name="realloc">
3621 <sect1>get_ostype<label id="get_ostype"><p>
3625 <tag/Function/The function returns the operating system, the program runs on.
3626 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3627 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3628 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3629 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3630 all supported targets. If it exists, it returns a number that identifies the
3631 operating system or machine type, the program runs on. The machine dependent
3632 header files define constants that can be used to check the return code.
3633 <tag/Notes/<itemize>
3634 <item>The function does not exist on all platforms.
3635 <item>The return codes are platform dependent.
3637 <tag/Availability/cc65 (not all platforms)
3643 <sect1>get_c128_speed<label id="get_c128_speed"><p>
3647 <tag/Function/Get the current speed of the C128 CPU.
3648 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3649 <tag/Declaration/<tt/unsigned char get_c128_speed (void);/
3650 <tag/Description/The function returns the current speed of the C128 CPU.
3651 <tag/Notes/<itemize>
3652 <item>The function is specific to the C64 and C128.
3653 <item>The function does not check if the C128 CPU is the current CPU.
3654 <item>See the accelerator.h header for the speed definitions.
3656 <tag/Availability/cc65 (not all platforms)
3658 <ref id="detect_c128" name="detect_c128">,
3659 <ref id="set_c128_speed" name="set_c128_speed">,
3665 <sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p>
3669 <tag/Function/Get the current speed of the C64DTV.
3670 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3671 <tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/
3672 <tag/Description/The function returns the current speed of the C64DTV.
3673 <tag/Notes/<itemize>
3674 <item>The function is specific to the C64.
3675 <item>The function does not check for the presence of the C64DTV.
3676 <item>See the accelerator.h header for the speed definitions.
3678 <tag/Availability/cc65 (not all platforms)
3680 <ref id="detect_c64dtv" name="detect_c64dtv">,
3681 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3687 <sect1>get_c65_speed<label id="get_c65_speed"><p>
3691 <tag/Function/Get the current speed of the C65/C64DX in C64 mode.
3692 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3693 <tag/Declaration/<tt/unsigned char get_c65_speed (void);/
3694 <tag/Description/The function returns the current speed of the C65/C64DX in C64 mode.
3695 <tag/Notes/<itemize>
3696 <item>The function is specific to the C64.
3697 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
3698 <item>See the accelerator.h header for the speed definitions.
3700 <tag/Availability/cc65 (not all platforms)
3702 <ref id="detect_c65" name="detect_c65">,
3703 <ref id="set_c65_speed" name="set_c65_speed">,
3709 <sect1>get_chameleon_speed<label id="get_chameleon_speed"><p>
3713 <tag/Function/Get the current speed of the C64 Chameleon cartridge.
3714 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3715 <tag/Declaration/<tt/unsigned char get_chameleon_speed (void);/
3716 <tag/Description/The function returns the current speed of the C64 Chameleon cartridge.
3717 <tag/Notes/<itemize>
3718 <item>The function is specific to the C64.
3719 <item>The function does not check for the presence of the C64 Chameleon cartridge.
3720 <item>See the accelerator.h header for the speed definitions.
3722 <tag/Availability/cc65 (not all platforms)
3724 <ref id="detect_chameleon" name="detect_chameleon">,
3725 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3731 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3735 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3736 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3737 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3738 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3739 <tag/Notes/<itemize>
3740 <item>The function is specific to the C128 and C64.
3741 <item>The function does not check for the presence of the cartridge.
3742 <item>See the accelerator.h header for the speed definitions.
3744 <tag/Availability/cc65 (not all platforms)
3746 <ref id="detect_scpu" name="detect_scpu">,
3747 <ref id="set_scpu_speed" name="set_scpu_speed">,
3753 <sect1>get_turbomaster_speed<label id="get_turbomaster_speed"><p>
3757 <tag/Function/Get the current speed of the C64 Turbo Master cartridge.
3758 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3759 <tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/
3760 <tag/Description/The function returns the current speed of the C64 Turbo Master cartridge.
3761 <tag/Notes/<itemize>
3762 <item>The function is specific to the C64.
3763 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
3764 <item>See the accelerator.h header for the speed definitions.
3766 <tag/Availability/cc65 (not all platforms)
3768 <ref id="detect_turbomaster" name="detect_turbomaster">,
3769 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3774 <sect1>getcpu<label id="getcpu"><p>
3778 <tag/Function/Determine on which CPU the program is running.
3779 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3780 <tag/Declaration/<tt/unsigned char getcpu (void);/
3781 <tag/Description/The function checks on which CPU the code is running. It
3782 returns one of the constants<itemize>
3784 <item><tt/CPU_65C02/
3785 <item><tt/CPU_65816/
3787 <item><tt/CPU_65SC02/
3788 <item><tt/CPU_65CE02/
3789 <item><tt/CPU_HUC6280/
3792 <tag/Notes/<itemize>
3793 <item>Other, more exotic CPU types are not disinguished.
3795 <tag/Availability/cc65
3801 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3805 <tag/Function/Get current device.
3806 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3807 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3808 <tag/Description/The function returns the current device.
3809 It allows to access the current device with the <ref id="dio.h"
3810 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3811 functions"> requiring a 'device' parameter.
3812 <tag/Availability/cc65
3814 <ref id="getdevicedir" name="getdevicedir">,
3815 <ref id="getfirstdevice" name="getfirstdevice">,
3816 <ref id="getnextdevice" name="getnextdevice">
3818 dio_open (getcurrentdevice ());
3824 <sect1>getcwd<label id="getcwd"><p>
3828 <tag/Function/Get current working directory.
3829 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3830 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3831 <tag/Description/The function will return the current working directory.
3832 <tag/Notes/<itemize>
3833 <item>The function is only available as fastcall function, so it may only
3834 be used in presence of a prototype.
3836 <tag/Availability/POSIX 1003.1
3842 <sect1>getdevicedir<label id="getdevicedir"><p>
3846 <tag/Function/Get device directory.
3847 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3848 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3849 <tag/Description/The function returns the directory representing <tt/device/.
3850 It allows to access the device on filesystem level by calling chdir() with
3851 the directory returned.
3852 <tag/Notes/<itemize>
3853 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3854 floppy-disk-type device and returns NULL if that check fails.
3855 <item>The function is only available as fastcall function, so it may only
3856 be used in presence of a prototype.
3858 <tag/Availability/cc65
3860 <ref id="getcwd" name="getcwd">,
3861 <ref id="getcurrentdevice" name="getcurrentdevice">,
3862 <ref id="getfirstdevice" name="getfirstdevice">,
3863 <ref id="getnextdevice" name="getnextdevice">
3865 chdir (getdevicedir (device, buf, sizeof buf));
3867 cf. <tt/samples/enumdevdir.c/
3872 <sect1>getenv<label id="getenv"><p>
3876 <tag/Function/Return a value from the environment.
3877 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3878 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3879 <tag/Description/The function searches the environment for an entry that
3880 matches <tt/name/ and returns its value. The environment consists of a list
3881 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3883 <tag/Notes/<itemize>
3884 <item>What exactly is stored in the environment depends on the machine the
3885 program is running on.
3886 <item>The function is only available as fastcall function, so it may only
3887 be used in presence of a prototype.
3889 <tag/Availability/ISO 9899
3895 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3899 <tag/Function/Get first device.
3900 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3901 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3902 <tag/Description/The function returns the first device.
3903 The constant <tt/INVALID_DEVICE/ indicates no device.
3904 <tag/Notes/<itemize>
3905 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3906 drive-type device and does <em/not/ check for a disk in the drive.
3908 <tag/Availability/cc65
3910 <ref id="getcurrentdevice" name="getcurrentdevice">,
3911 <ref id="getdevicedir" name="getdevicedir">,
3912 <ref id="getnextdevice" name="getnextdevice">
3914 unsigned char dev = getfirstdevice ();
3915 while (dev != INVALID_DEVICE) {
3916 printf ("%d\n", dev);
3917 dev = getnextdevice (dev);
3924 <sect1>getnextdevice<label id="getnextdevice"><p>
3928 <tag/Function/Get next device.
3929 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3930 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3931 <tag/Description/The function returns the next device after <tt/device/.
3932 The constant <tt/INVALID_DEVICE/ indicates no further device.
3933 <tag/Notes/<itemize>
3934 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3935 drive-type device and does <em/not/ check for a disk in the drive.
3936 <item>The function is only available as fastcall function, so it may only
3937 be used in presence of a prototype.
3939 <tag/Availability/cc65
3941 <ref id="getcurrentdevice" name="getcurrentdevice">,
3942 <ref id="getdevicedir" name="getdevicedir">,
3943 <ref id="getfirstdevice" name="getfirstdevice">
3945 unsigned char dev = getfirstdevice ();
3946 while (dev != INVALID_DEVICE) {
3947 printf ("%d\n", dev);
3948 dev = getnextdevice (dev);
3955 <sect1>getopt<label id="getopt"><p>
3959 <tag/Function/Parse command line options.
3960 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3961 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3962 const char* optstring);/
3963 <tag/Description/The function parses command line arguments, <tt/argc/ and
3964 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3965 is a string that contains command line option characters. If a character in
3966 <tt/optstring/ is followed by a colon, the option requires an argument. An
3967 option on the command line is recognized if it is one of the option characters
3969 <tt/getopt/ must be called repeatedly. It will return each option character
3970 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3971 option argument is placed in <tt/optarg/, the index of the next element on the
3972 command line to be processed is placed in <tt/optind/.
3973 <tag/Notes/<itemize>
3974 <item>The implementation will not reorder options. A non option on the command
3975 line will terminate option processing. All remaining arguments are not
3976 recognized as options, even if the start with a '-' character.
3977 <item>The function is only available as fastcall function, so it may only
3978 be used in presence of a prototype.
3980 <tag/Availability/POSIX.2
3986 <sect1>gotox<label id="gotox"><p>
3990 <tag/Function/Move the text mode cursor to a new X position.
3991 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3992 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3993 <tag/Description/The function moves the text mode cursor to the specified X
3994 position while leaving the Y position untouched. The leftmost position on the
3995 screen has the coordinate 0.
3996 <tag/Notes/<itemize>
3997 <item>The function is only available as fastcall function, so it may
3998 only be used in presence of a prototype.
3999 <item>Invalid values for the X position (out of screen coordinates) may
4000 lead to undefined behaviour.
4002 <tag/Availability/cc65
4004 <ref id="gotoy" name="gotoy">,
4005 <ref id="gotoxy" name="gotoxy">,
4006 <ref id="wherex" name="wherex">,
4007 <ref id="wherey" name="wherey">
4013 <sect1>gotoxy<label id="gotoxy"><p>
4017 <tag/Function/Move the text mode cursor to a new position.
4018 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4019 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
4020 <tag/Description/The function moves the text mode cursor to the specified
4021 position. The leftmost position on the screen has the X coordinate 0, the
4022 topmost line has the Y coordinate 0.
4023 <tag/Notes/<itemize>
4024 <item>The function is only available as fastcall function, so it may only be
4025 used in presence of a prototype.
4026 <item>Invalid values for any of both coordinates (out of screen positions) may
4027 lead to undefined behaviour.
4029 <tag/Availability/cc65
4031 <ref id="gotox" name="gotox">,
4032 <ref id="gotoy" name="gotoy">,
4033 <ref id="wherex" name="wherex">,
4034 <ref id="wherey" name="wherey">
4040 <sect1>gotoy<label id="gotoy"><p>
4044 <tag/Function/Move the text mode cursor to a new Y position.
4045 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4046 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
4047 <tag/Description/The function moves the text mode cursor to the specified Y
4048 position while leaving the X position untouched. The uppermost position on the
4049 screen has the coordinate 0.
4050 <tag/Notes/<itemize>
4051 <item>The function is only available as fastcall function, so it may
4052 only be used in presence of a prototype.
4053 <item>Invalid values for the Y position (out of screen coordinates) may lead
4054 to undefined behaviour.
4056 <tag/Availability/cc65
4058 <ref id="gotox" name="gotox">,
4059 <ref id="gotoxy" name="gotoxy">,
4060 <ref id="wherex" name="wherex">,
4061 <ref id="wherey" name="wherey">
4067 <sect1>isalnum<label id="isalnum"><p>
4071 <tag/Function/Check if a given character is a letter or digit.
4072 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4073 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
4074 <tag/Description/The function returns a non zero value if the given argument
4075 is a letter or digit. The return value is zero if the character is anything
4077 <tag/Notes/<itemize>
4078 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4079 inline sequence generated by the macro will not work correctly for values
4080 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4081 this range. The non inline function may be accessed by <tt/#undef/'ing
4083 <item>When compiling without <tt/-Os/, the function is only available as
4084 fastcall function, so it may only be used in presence of a prototype.
4086 <tag/Availability/ISO 9899
4088 <ref id="isalpha" name="isalpha">,
4089 <ref id="isascii" name="isascii">,
4090 <ref id="isblank" name="isblank">,
4091 <ref id="iscntrl" name="iscntrl">,
4092 <ref id="isdigit" name="isdigit">,
4093 <ref id="isgraph" name="isgraph">,
4094 <ref id="islower" name="islower">,
4095 <ref id="isprint" name="isprint">,
4096 <ref id="ispunct" name="ispunct">,
4097 <ref id="isspace" name="isspace">,
4098 <ref id="isupper" name="isupper">,
4099 <ref id="isxdigit" name="isxdigit">
4105 <sect1>isalpha<label id="isalpha"><p>
4109 <tag/Function/Check if a given character is a letter.
4110 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4111 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
4112 <tag/Description/The function returns a non zero value if the given argument
4113 is a letter. The return value is zero if the character is anything else.
4114 <tag/Notes/<itemize>
4115 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4116 inline sequence generated by the macro will not work correctly for values
4117 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4118 this range. The non inline function may be accessed by <tt/#undef/'ing the
4120 <item>When compiling without <tt/-Os/, the function is only available as
4121 fastcall function, so it may only be used in presence of a prototype.
4123 <tag/Availability/ISO 9899
4125 <ref id="isalnum" name="isalnum">,
4126 <ref id="isascii" name="isascii">,
4127 <ref id="isblank" name="isblank">,
4128 <ref id="iscntrl" name="iscntrl">,
4129 <ref id="isdigit" name="isdigit">,
4130 <ref id="isgraph" name="isgraph">,
4131 <ref id="islower" name="islower">,
4132 <ref id="isprint" name="isprint">,
4133 <ref id="ispunct" name="ispunct">,
4134 <ref id="isspace" name="isspace">,
4135 <ref id="isupper" name="isupper">,
4136 <ref id="isxdigit" name="isxdigit">
4142 <sect1>isascii<label id="isascii"><p>
4146 <tag/Function/Check if a given character is in the ASCII (0..127) range.
4147 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4148 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
4149 <tag/Description/The function returns a non zero value if the given argument
4150 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
4151 <tag/Notes/<itemize>
4152 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4153 inline sequence generated by the macro will not work correctly for values
4154 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4155 this range. The non inline function may be accessed by <tt/#undef/'ing the
4157 <item>When compiling without <tt/-Os/, the function is only available as
4158 fastcall function, so it may only be used in presence of a prototype.
4160 <tag/Availability/ISO 9899
4162 <ref id="isalnum" name="isalnum">,
4163 <ref id="isalpha" name="isalpha">,
4164 <ref id="isblank" name="isblank">,
4165 <ref id="iscntrl" name="iscntrl">,
4166 <ref id="isdigit" name="isdigit">,
4167 <ref id="isgraph" name="isgraph">,
4168 <ref id="islower" name="islower">,
4169 <ref id="isprint" name="isprint">,
4170 <ref id="ispunct" name="ispunct">,
4171 <ref id="isspace" name="isspace">,
4172 <ref id="isupper" name="isupper">,
4173 <ref id="isxdigit" name="isxdigit">
4179 <sect1>isblank<label id="isblank"><p>
4183 <tag/Function/Check if a given character is a space or tab.
4184 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4185 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
4186 <tag/Description/The function returns a non zero value if the given argument
4187 is a space or tab character. The return value is zero if the character is
4189 <tag/Notes/<itemize>
4190 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4191 inline sequence generated by the macro will not work correctly for values
4192 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4193 this range. The non inline function may be accessed by <tt/#undef/'ing the
4195 <item>When compiling without <tt/-Os/, the function is only available as
4196 fastcall function, so it may only be used in presence of a prototype.
4198 <tag/Availability/ISO 9899
4200 <ref id="isalnum" name="isalnum">,
4201 <ref id="isalpha" name="isalpha">,
4202 <ref id="isascii" name="isascii">,
4203 <ref id="iscntrl" name="iscntrl">,
4204 <ref id="isdigit" name="isdigit">,
4205 <ref id="isgraph" name="isgraph">,
4206 <ref id="islower" name="islower">,
4207 <ref id="isprint" name="isprint">,
4208 <ref id="ispunct" name="ispunct">,
4209 <ref id="isspace" name="isspace">,
4210 <ref id="isupper" name="isupper">,
4211 <ref id="isxdigit" name="isxdigit">
4217 <sect1>iscntrl<label id="iscntrl"><p>
4221 <tag/Function/Check if a given character is a control character.
4222 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4223 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
4224 <tag/Description/The function returns a non zero value if the given argument
4225 is a control character. The return value is zero if the character is anything
4227 <tag/Notes/<itemize>
4228 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4229 inline sequence generated by the macro will not work correctly for values
4230 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4231 this range. The non inline function may be accessed by <tt/#undef/'ing the
4233 <item>When compiling without <tt/-Os/, the function is only available as
4234 fastcall function, so it may only be used in presence of a prototype.
4236 <tag/Availability/ISO 9899
4238 <ref id="isalnum" name="isalnum">,
4239 <ref id="isalpha" name="isalpha">,
4240 <ref id="isascii" name="isascii">,
4241 <ref id="isblank" name="isblank">,
4242 <ref id="isdigit" name="isdigit">,
4243 <ref id="isgraph" name="isgraph">,
4244 <ref id="islower" name="islower">,
4245 <ref id="isprint" name="isprint">,
4246 <ref id="ispunct" name="ispunct">,
4247 <ref id="isspace" name="isspace">,
4248 <ref id="isupper" name="isupper">,
4249 <ref id="isxdigit" name="isxdigit">
4255 <sect1>isdigit<label id="isdigit"><p>
4259 <tag/Function/Check if a given character is a digit.
4260 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4261 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
4262 <tag/Description/The function returns a non zero value if the given argument
4263 is a digit. The return value is zero if the character is anything else.
4264 <tag/Notes/<itemize>
4265 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4266 inline sequence generated by the macro will not work correctly for values
4267 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4268 this range. The non inline function may be accessed by <tt/#undef/'ing the
4270 <item>When compiling without <tt/-Os/, the function is only available as
4271 fastcall function, so it may only be used in presence of a prototype.
4273 <tag/Availability/ISO 9899
4275 <ref id="isalnum" name="isalnum">,
4276 <ref id="isalpha" name="isalpha">,
4277 <ref id="isascii" name="isascii">,
4278 <ref id="isblank" name="isblank">,
4279 <ref id="iscntrl" name="iscntrl">,
4280 <ref id="isgraph" name="isgraph">,
4281 <ref id="islower" name="islower">,
4282 <ref id="isprint" name="isprint">,
4283 <ref id="ispunct" name="ispunct">,
4284 <ref id="isspace" name="isspace">,
4285 <ref id="isupper" name="isupper">,
4286 <ref id="isxdigit" name="isxdigit">
4292 <sect1>isfast<label id="isfast"><p>
4296 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4297 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4298 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4299 <tag/Declaration/<tt/unsigned char isfast (void);/
4300 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4301 <tag/Notes/<itemize>
4302 <item>The function is specific to the C128, C16 and Plus4.
4304 <tag/Availability/cc65 (not all platforms)
4306 <ref id="fast" name="fast">,
4307 <ref id="slow" name="slow">,
4313 <sect1>isgraph<label id="isgraph"><p>
4317 <tag/Function/Check if a given character is a printable character (except
4319 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4320 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4321 <tag/Description/The function returns a non zero value if the given argument
4322 is a printable character with the exception of space. The return value is zero
4323 if the character is anything else.
4324 <tag/Notes/<itemize>
4325 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4326 inline sequence generated by the macro will not work correctly for values
4327 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4328 this range. The non inline function may be accessed by <tt/#undef/'ing the
4330 <item>When compiling without <tt/-Os/, the function is only available as
4331 fastcall function, so it may only be used in presence of a prototype.
4333 <tag/Availability/ISO 9899
4335 <ref id="isalnum" name="isalnum">,
4336 <ref id="isalpha" name="isalpha">,
4337 <ref id="isascii" name="isascii">,
4338 <ref id="isblank" name="isblank">,
4339 <ref id="iscntrl" name="iscntrl">,
4340 <ref id="isdigit" name="isdigit">,
4341 <ref id="islower" name="islower">,
4342 <ref id="isprint" name="isprint">,
4343 <ref id="ispunct" name="ispunct">,
4344 <ref id="isspace" name="isspace">,
4345 <ref id="isupper" name="isupper">,
4346 <ref id="isxdigit" name="isxdigit">
4352 <sect1>islower<label id="islower"><p>
4356 <tag/Function/Check if a given character is a lower case letter.
4357 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4358 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4359 <tag/Description/The function returns a non zero value if the given argument
4360 is a lower case letter. The return value is zero if the character is anything
4362 <tag/Notes/<itemize>
4363 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4364 inline sequence generated by the macro will not work correctly for values
4365 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4366 this range. The non inline function may be accessed by <tt/#undef/'ing the
4368 <item>When compiling without <tt/-Os/, the function is only available as
4369 fastcall function, so it may only be used in presence of a prototype.
4371 <tag/Availability/ISO 9899
4373 <ref id="isalnum" name="isalnum">,
4374 <ref id="isalpha" name="isalpha">,
4375 <ref id="isascii" name="isascii">,
4376 <ref id="isblank" name="isblank">,
4377 <ref id="iscntrl" name="iscntrl">,
4378 <ref id="isdigit" name="isdigit">,
4379 <ref id="isgraph" name="isgraph">,
4380 <ref id="isprint" name="isprint">,
4381 <ref id="ispunct" name="ispunct">,
4382 <ref id="isspace" name="isspace">,
4383 <ref id="isupper" name="isupper">,
4384 <ref id="isxdigit" name="isxdigit">
4390 <sect1>isprint<label id="isprint"><p>
4394 <tag/Function/Check if a given character is a printable character.
4395 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4396 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4397 <tag/Description/The function returns a non zero value if the given argument
4398 is a printable character (this includes the space character). The return value
4399 is zero if the character is anything else.
4400 <tag/Notes/<itemize>
4401 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4402 inline sequence generated by the macro will not work correctly for values
4403 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4404 this range. The non inline function may be accessed by <tt/#undef/'ing the
4406 <item>When compiling without <tt/-Os/, the function is only available as
4407 fastcall function, so it may only be used in presence of a prototype.
4409 <tag/Availability/ISO 9899
4411 <ref id="isalnum" name="isalnum">,
4412 <ref id="isalpha" name="isalpha">,
4413 <ref id="isascii" name="isascii">,
4414 <ref id="isblank" name="isblank">,
4415 <ref id="iscntrl" name="iscntrl">,
4416 <ref id="isdigit" name="isdigit">,
4417 <ref id="isgraph" name="isgraph">,
4418 <ref id="islower" name="islower">,
4419 <ref id="ispunct" name="ispunct">,
4420 <ref id="isspace" name="isspace">,
4421 <ref id="isupper" name="isupper">,
4422 <ref id="isxdigit" name="isxdigit">
4428 <sect1>ispunct<label id="ispunct"><p>
4432 <tag/Function/Check if a given character is a printable character but not a
4433 space or an alphanumeric character.
4434 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4435 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4436 <tag/Description/The function returns a non zero value if the given argument
4437 is a printable character, but not a space or anything alphanumeric. The return
4438 value is zero if the character is anything else.
4439 <tag/Notes/<itemize>
4440 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4441 inline sequence generated by the macro will not work correctly for values
4442 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4443 this range. The non inline function may be accessed by <tt/#undef/'ing the
4445 <item>When compiling without <tt/-Os/, the function is only available as
4446 fastcall function, so it may only be used in presence of a prototype.
4448 <tag/Availability/ISO 9899
4450 <ref id="isalnum" name="isalnum">,
4451 <ref id="isalpha" name="isalpha">,
4452 <ref id="isascii" name="isascii">,
4453 <ref id="isblank" name="isblank">,
4454 <ref id="iscntrl" name="iscntrl">,
4455 <ref id="isdigit" name="isdigit">,
4456 <ref id="isgraph" name="isgraph">,
4457 <ref id="islower" name="islower">,
4458 <ref id="isprint" name="isprint">,
4459 <ref id="isspace" name="isspace">,
4460 <ref id="isupper" name="isupper">,
4461 <ref id="isxdigit" name="isxdigit">
4467 <sect1>isspace<label id="isspace"><p>
4471 <tag/Function/Check if a given character is a white-space character.
4472 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4473 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4474 <tag/Description/The function returns a non zero value if the given argument
4475 is a white space character. The return value is zero if the character is
4476 anything else. The standard white space characters are: space, formfeed ('\f'),
4477 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4479 <tag/Notes/<itemize>
4480 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4481 inline sequence generated by the macro will not work correctly for values
4482 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4483 this range. The non inline function may be accessed by <tt/#undef/'ing the
4485 <item>When compiling without <tt/-Os/, the function is only available as
4486 fastcall function, so it may only be used in presence of a prototype.
4488 <tag/Availability/ISO 9899
4490 <ref id="isalnum" name="isalnum">,
4491 <ref id="isalpha" name="isalpha">,
4492 <ref id="isascii" name="isascii">,
4493 <ref id="isblank" name="isblank">,
4494 <ref id="iscntrl" name="iscntrl">,
4495 <ref id="isdigit" name="isdigit">,
4496 <ref id="isgraph" name="isgraph">,
4497 <ref id="islower" name="islower">,
4498 <ref id="isprint" name="isprint">,
4499 <ref id="ispunct" name="ispunct">,
4500 <ref id="isupper" name="isupper">,
4501 <ref id="isxdigit" name="isxdigit">
4507 <sect1>isupper<label id="isupper"><p>
4511 <tag/Function/Check if a given character is an upper case letter.
4512 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4513 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4514 <tag/Description/The function returns a non zero value if the given argument
4515 is an upper case letter. The return value is zero if the character is anything
4517 <tag/Notes/<itemize>
4518 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4519 inline sequence generated by the macro will not work correctly for values
4520 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4521 this range. The non inline function may be accessed by <tt/#undef/'ing the
4523 <item>When compiling without <tt/-Os/, the function is only available as
4524 fastcall function, so it may only be used in presence of a prototype.
4526 <tag/Availability/ISO 9899
4528 <ref id="isalnum" name="isalnum">,
4529 <ref id="isalpha" name="isalpha">,
4530 <ref id="isascii" name="isascii">,
4531 <ref id="isblank" name="isblank">,
4532 <ref id="iscntrl" name="iscntrl">,
4533 <ref id="isdigit" name="isdigit">,
4534 <ref id="isgraph" name="isgraph">,
4535 <ref id="islower" name="islower">,
4536 <ref id="isprint" name="isprint">,
4537 <ref id="ispunct" name="ispunct">,
4538 <ref id="isspace" name="isspace">,
4539 <ref id="isxdigit" name="isxdigit">
4545 <sect1>isxdigit<label id="isxdigit"><p>
4549 <tag/Function/Check if a given character is a hexadecimal digit.
4550 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4551 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4552 <tag/Description/The function returns a non zero value if the given argument
4553 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4554 character is anything else.
4555 <tag/Notes/<itemize>
4556 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4557 inline sequence generated by the macro will not work correctly for values
4558 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4559 this range. The non inline function may be accessed by <tt/#undef/'ing the
4561 <item>When compiling without <tt/-Os/, the function is only available as
4562 fastcall function, so it may only be used in presence of a prototype.
4564 <tag/Availability/ISO 9899
4566 <ref id="isalnum" name="isalnum">,
4567 <ref id="isalpha" name="isalpha">,
4568 <ref id="isascii" name="isascii">,
4569 <ref id="isblank" name="isblank">,
4570 <ref id="iscntrl" name="iscntrl">,
4571 <ref id="isdigit" name="isdigit">,
4572 <ref id="isgraph" name="isgraph">,
4573 <ref id="islower" name="islower">,
4574 <ref id="isprint" name="isprint">,
4575 <ref id="ispunct" name="ispunct">,
4576 <ref id="isspace" name="isspace">,
4577 <ref id="isupper" name="isupper">
4583 <sect1>itoa<label id="itoa"><p>
4587 <tag/Function/Convert an integer into a string.
4588 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4589 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4590 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4591 <tt/radix/ as the base.
4592 <tag/Notes/<itemize>
4593 <item>There are no provisions to prevent a buffer overflow.
4594 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4595 <item>The function is non standard, so it is not available in strict ANSI mode.
4596 You should probably use <tt/sprintf/ instead.
4597 <item>The function is only available as fastcall function, so it may only be
4598 used in presence of a prototype.
4600 <tag/Availability/cc65
4602 <ref id="atoi" name="atoi">,
4603 <ref id="atol" name="atol">,
4604 <ref id="ltoa" name="ltoa">,
4605 <ref id="ultoa" name="ultoa">,
4606 <ref id="utoa" name="utoa">
4612 <sect1>joy_count<label id="joy_count"><p>
4616 <tag/Function/Return the number of joysticks supported by the current driver.
4617 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4618 <tag/Declaration/<tt/unsigned char joy_count (void);/
4619 <tag/Description/The function returns a the number of joysticks supported
4620 by the current joystick driver.
4621 <tag/Notes/<itemize>
4622 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4623 name="joy_load_driver"> before calling this function.
4624 <item>The function returns the number of joysticks supported by the driver.
4625 There's no way to check for the number of actually connected joysticks.
4627 <tag/Availability/cc65
4629 <ref id="joy_load_driver" name="joy_load_driver">,
4630 <ref id="joy_read" name="joy_read">
4636 <sect1>joy_install<label id="joy_install"><p>
4640 <tag/Function/Install an already loaded driver and return an error code.
4641 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4642 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4643 <tag/Description/The function installs a driver that was already loaded into
4644 memory (or linked statically to the program). It returns an error code
4645 (<tt/JOY_ERR_OK/ in case of success).
4646 <tag/Notes/<itemize>
4647 <item>The function is only available as fastcall function, so it may only be
4648 used in presence of a prototype.
4650 <tag/Availability/cc65
4652 <ref id="joy_load_driver" name="joy_load_driver">,
4653 <ref id="joy_uninstall" name="joy_uninstall">,
4654 <ref id="joy_unload" name="joy_unload">
4660 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4664 <tag/Function/Load a driver from disk and install it.
4665 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4666 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4667 <tag/Description/The function loads a driver with the given name from disk
4668 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4669 driver was successfully loaded and installed.
4670 <tag/Notes/<itemize>
4671 <item>The function is only available as fastcall function, so it may only be
4672 used in presence of a prototype.
4674 <tag/Availability/cc65
4676 <ref id="joy_install" name="joy_install">,
4677 <ref id="joy_uninstall" name="joy_uninstall">,
4678 <ref id="joy_unload" name="joy_unload">
4684 <sect1>joy_read<label id="joy_read"><p>
4688 <tag/Function/Read the status of a joystick.
4689 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4690 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4691 <tag/Description/The function reads the status bits for a joystick. The number
4692 of the joystick is passed as parameter. The result may be examined by using one
4693 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4694 <tag/Notes/<itemize>
4695 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4696 name="joy_load_driver"> before calling this function.
4697 <item>The function is only available as fastcall function, so it may only be
4698 used in presence of a prototype.
4700 <tag/Availability/cc65
4702 <ref id="joy_count" name="joy_count">,
4703 <ref id="joy_load_driver" name="joy_load_driver">,
4704 <ref id="joy_unload" name="joy_unload">
4710 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4714 <tag/Function/Uninstall the current joystick driver.
4715 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4716 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4717 <tag/Description/The function uninstalls the currently installed joystick
4718 driver. It does not remove the driver from memory. The function returns an
4719 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4720 <tag/Notes/<itemize>
4721 <item>A joystick driver must be installed using <ref id="joy_install"
4722 name="joy_install"> before calling this function.
4724 <tag/Availability/cc65
4726 <ref id="joy_install" name="joy_install">,
4727 <ref id="joy_load_driver" name="joy_load_driver">,
4728 <ref id="joy_unload" name="joy_unload">
4734 <sect1>joy_unload<label id="joy_unload"><p>
4738 <tag/Function/Uninstall, then unload the current joystick driver.
4739 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4740 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4741 <tag/Description/The function uninstalls the currently installed joystick
4742 driver and removes it from memory. An error code is returned, which is
4743 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4744 <tag/Notes/<itemize>
4745 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4746 name="joy_load_driver"> before calling this function.
4748 <tag/Availability/cc65
4750 <ref id="joy_load_driver" name="joy_load_driver">
4756 <sect1>kbhit<label id="kbhit"><p>
4760 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4761 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4762 <tag/Declaration/<tt/unsigned char kbhit (void);/
4763 <tag/Description/The function returns a value of zero if there is no character
4764 waiting to be read from the keyboard. It returns non zero otherwise.
4765 <tag/Notes/<itemize>
4766 <item>If the system does not support a keyboard buffer (most systems
4767 do), the function is rather useless.
4769 <tag/Availability/cc65
4771 <ref id="cgetc" name="cgetc">,
4772 <ref id="cursor" name="cursor">
4778 <sect1>kbrepeat<label id="kbrepeat"><p>
4782 <tag/Function/Set the keyboard repeat mode.
4783 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4784 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4785 <tag/Description/This function changes which keys have automatic repeat when
4786 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4787 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4788 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4789 it can be restored later.
4790 <tag/Notes/<itemize>
4791 <item>The function is available only as a fastcall function; so, it may be used
4792 only in the presence of a prototype.
4794 <tag/Availability/cc65
4800 <sect1>labs<label id="labs"><p>
4804 <tag/Function/Returns the absolute value of a long integer.
4805 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4806 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4807 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4809 <tag/Notes/<itemize>
4810 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4811 <item>The function is only available as fastcall function, so it may only be
4812 used in presence of a prototype.
4814 <tag/Availability/ISO 9899
4816 <ref id="abs" name="abs">
4822 <sect1>ltoa<label id="ltoa"><p>
4826 <tag/Function/Convert a long integer into a string.
4827 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4828 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4829 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4830 using <tt/radix/ as the base.
4831 <tag/Notes/<itemize>
4832 <item>There are no provisions to prevent a buffer overflow.
4833 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4834 <item>The function is non standard, so it is not available in strict ANSI mode.
4835 You should probably use <tt/sprintf/ instead.
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/cc65
4841 <ref id="atoi" name="atoi">,
4842 <ref id="atol" name="atol">,
4843 <ref id="itoa" name="itoa">,
4844 <ref id="ultoa" name="ultoa">,
4845 <ref id="utoa" name="utoa">
4851 <sect1>localeconv<label id="localeconv"><p>
4855 <tag/Function/Returns a pointer to the current locale structure.
4856 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4857 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4858 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4860 <tag/Notes/<itemize>
4861 <item>cc65 supports only the "C" locale, so even after setting a new locale
4862 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4865 <tag/Availability/ISO 9899
4867 <ref id="setlocale" name="setlocale">
4873 <sect1>longjmp<label id="longjmp"><p>
4877 <tag/Function/Non local goto.
4878 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4879 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4880 <tag/Description/The <tt/longjmp/ function restores a program context from the
4881 data in <tt/buf/, which must have been set by a preceeding call to
4882 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4883 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4885 <tag/Notes/<itemize>
4886 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4887 was called with a value of one.
4888 <item>The function is only available as fastcall function, so it may only
4889 be used in presence of a prototype.
4891 <tag/Availability/ISO 9899
4893 <ref id="setjmp" name="setjmp">
4899 <sect1>malloc<label id="malloc"><p>
4903 <tag/Function/Allocate dynamic memory.
4904 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4905 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4906 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4907 pointer to the allocated memory block. On error (not enough memory available),
4908 <tt/malloc/ returns <tt/NULL/.
4909 <tag/Notes/<itemize>
4910 <item>The function is only available as fastcall function, so it may only
4911 be used in presence of a prototype.
4913 <tag/Availability/ISO 9899
4915 <ref id="_heapadd" name="_heapadd">,
4916 <ref id="_heapblocksize" name="_heapblocksize">,
4917 <ref id="_heapmaxavail" name="_heapmaxavail">,
4918 <ref id="_heapmemavail" name="_heapmemavail">,
4919 <ref id="calloc" name="calloc">,
4920 <ref id="free" name="free">,
4921 <ref id="realloc" name="realloc">,
4922 <ref id="strdup" name="strdup">
4928 <sect1>memchr<label id="memchr"><p>
4932 <tag/Function/Search for a character in a block of raw memory.
4933 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4934 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4935 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4936 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4937 that is of size <tt/count/. Upon completion, the function returns a pointer to
4938 the character found, or a null pointer if the character was not found.
4939 <tag/Notes/<itemize>
4940 <item>The function is only available as fastcall function, so it may only
4941 be used in presence of a prototype.
4943 <tag/Availability/ISO 9899
4945 <ref id="strchr" name="strchr">
4951 <sect1>memcmp<label id="memcmp"><p>
4955 <tag/Function/Compare two memory areas.
4956 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4957 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4958 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4959 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4960 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4961 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4962 <tag/Notes/<itemize>
4963 <item>The function is only available as fastcall function, so it may only
4964 be used in presence of a prototype.
4966 <tag/Availability/ISO 9899
4968 <ref id="strcmp" name="strcmp">,
4969 <ref id="memmove" name="memmove">,
4970 <ref id="memset" name="memset">
4976 <sect1>memcpy<label id="memcpy"><p>
4980 <tag/Function/Copy a memory area.
4981 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4982 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4983 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4984 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4986 <tag/Notes/<itemize>
4987 <item>The result is undefined if the memory areas do overlap. Use
4988 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4989 <item>The function is only available as fastcall function, so it may only
4990 be used in presence of a prototype.
4992 <tag/Availability/ISO 9899
4994 <ref id="_swap" name="_swap">,
4995 <ref id="memmove" name="memmove">,
4996 <ref id="memset" name="memset">
5002 <sect1>memmove<label id="memmove"><p>
5006 <tag/Function/Copy a memory area.
5007 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5008 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
5009 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
5010 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
5012 <tag/Notes/<itemize>
5013 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
5014 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
5015 <item>The function is only available as fastcall function, so it may only
5016 be used in presence of a prototype.
5018 <tag/Availability/ISO 9899
5020 <ref id="_swap" name="_swap">,
5021 <ref id="memcpy" name="memcpy">,
5022 <ref id="memset" name="memset">
5028 <sect1>memset<label id="memset"><p>
5032 <tag/Function/Fill a memory area.
5033 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5034 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
5035 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
5036 the value <tt/val/. The function returns <tt/p/.
5037 <tag/Notes/<itemize>
5038 <item>The function is only available as fastcall function, so it may only
5039 be used in presence of a prototype.
5041 <tag/Availability/ISO 9899
5043 <ref id="_swap" name="_swap">,
5044 <ref id="bzero" name="bzero">,
5045 <ref id="memcpy" name="memcpy">,
5046 <ref id="memmove" name="memmove">
5052 <sect1>mod_free<label id="mod_free"><p>
5056 <tag/Function/Free a relocatable module.
5057 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5058 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
5059 <tag/Description/The function will free a module loaded into memory by use of
5060 the <tt/<ref id="mod_load" name="mod_load">/ function.
5061 <tag/Notes/<itemize>
5062 <item>The pointer passed as parameter is the pointer to the module memory,
5063 not the pointer to the control structure.
5064 <item>The function is available only as a fastcall function; so, it may be used
5065 only in the presence of a prototype.
5067 <tag/Availability/cc65
5069 <ref id="mod_load" name="mod_load">
5075 <sect1>mod_load<label id="mod_load"><p>
5079 <tag/Function/Load a relocatable module.
5080 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5081 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
5082 <tag/Description/The function will load a code module into memory and relocate
5083 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
5084 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
5085 the module just loaded. Possible error codes are:
5087 <item><tt/MLOAD_OK/ - Module load successful
5088 <item><tt/MLOAD_ERR_READ/ - Read error
5089 <item><tt/MLOAD_ERR_HDR/ - Header error
5090 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
5091 <item><tt/MLOAD_ERR_FMT/ - Data format error
5092 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
5094 <tag/Notes/<itemize>
5095 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
5096 relocatable o65 modules for use with this function.
5097 <item>The function is available only as a fastcall function; so, it may be used
5098 only in the presence of a prototype.
5100 <tag/Availability/cc65
5102 <ref id="mod_free" name="mod_free">
5108 <sect1>mouse_setbox<label id="mouse_setbox"><p>
5112 <tag/Function/Specify a bounding box for the mouse cursor.
5113 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5114 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
5115 <tag/Description/The function allows to set a bounding box for mouse movement.
5116 <tag/Notes/<itemize>
5117 <item>The function does not check if the mouse cursor is currently within the
5118 given rectangle. Placing the mouse cursor within the bounding box is the
5119 responsibility of the programmer.
5120 <item>While the bounding box may be larger than the actual screen size, the
5121 standard mouse cursor draw routines may fail to set the cursor to coordinates
5122 outside of the screen area. Depending on the platform, you may have to supply
5123 your own mouse cursor routines.
5124 <item>The function is only available as fastcall function, so it may only be
5125 used in presence of a prototype.
5127 <tag/Availability/cc65
5129 <ref id="mouse_getbox" name="mouse_getbox">,
5130 <ref id="mouse_move" name="mouse_move">
5136 <sect1>mouse_getbox<label id="mouse_getbox"><p>
5140 <tag/Function/Return the current bounding box for the mouse cursor.
5141 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5142 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
5143 <tag/Description/The function queries the current bounding box for mouse
5145 <tag/Notes/<itemize>
5146 <item>The function is only available as fastcall function, so it may only be
5147 used in presence of a prototype.
5149 <tag/Availability/cc65
5151 <ref id="mouse_move" name="mouse_move">,
5152 <ref id="mouse_setbox" name="mouse_setbox">
5158 <sect1>mouse_buttons<label id="mouse_buttons"><p>
5162 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
5163 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5164 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
5165 <tag/Description/The function returns a bit mask that encodes the state of the
5166 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
5168 <tag/Availability/cc65
5170 <ref id="mouse_info" name="mouse_info">,
5171 <ref id="mouse_pos" name="mouse_pos">
5177 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
5181 <tag/Function/Return a readable error message for an error code.
5182 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5183 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
5185 <tag/Description/The function returns an error message (in english) for the
5186 error code passed parameter.
5187 <tag/Notes/<itemize>
5188 <item>The function will return "Unknown error" for invalid error codes.
5189 <item>The function is only available as fastcall function, so it may only be
5190 used in presence of a prototype.
5192 <tag/Availability/cc65
5194 <ref id="mouse_load_driver" name="mouse_load_driver">,
5195 <ref id="mouse_uninstall" name="mouse_uninstall">,
5196 <ref id="mouse_unload" name="mouse_unload">
5202 <sect1>mouse_hide<label id="mouse_hide"><p>
5206 <tag/Function/Hide the mouse pointer.
5207 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5208 <tag/Declaration/<tt/void mouse_hide (void);/
5209 <tag/Description/The function hides the mouse pointer. It manages a counter
5210 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
5211 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
5212 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
5214 <tag/Availability/cc65
5216 <ref id="mouse_show" name="mouse_show">
5222 <sect1>mouse_info<label id="mouse_info"><p>
5226 <tag/Function/Return the state of the mouse buttons and the position of the
5228 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5229 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
5230 <tag/Description/The function returns the state of the mouse buttons and the
5231 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
5232 <tag/Notes/<itemize>
5233 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
5234 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
5235 name="mouse_pos">/ instead.
5236 <item>The function is only available as fastcall function, so it may only be
5237 used in presence of a prototype.
5239 <tag/Availability/cc65
5241 <ref id="mouse_buttons" name="mouse_buttons">,
5242 <ref id="mouse_pos" name="mouse_pos">
5248 <sect1>mouse_install<label id="mouse_install"><p>
5252 <tag/Function/Install an already loaded mouse driver.
5253 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5254 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
5255 mouse_callbacks* c, void* driver);/
5256 <tag/Description/The function installs an already loaded mouse driver and
5257 returns an error code. The <tt/mouse_callbacks/ structure passed as first
5258 parameter contains pointers to routines needed to move or hide/show the mouse
5259 pointer. Defaults for these routines are supplied by the library, so if you
5260 can live with these defaults (which are platform specific), just pass a
5261 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
5262 driver linked statically to the program.
5263 <tag/Notes/<itemize>
5264 <item>Not all drivers are able to detect if the supported hardware is really
5266 <item>After installing a driver, the mouse cursor is hidden.
5267 <item>The function is only available as fastcall function, so it may only be
5268 used in presence of a prototype.
5270 <tag/Availability/cc65
5272 <ref id="mouse_load_driver" name="mouse_load_driver">,
5273 <ref id="mouse_uninstall" name="mouse_uninstall">,
5274 <ref id="mouse_unload" name="mouse_unload">
5280 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5284 <tag/Function/Call the driver specific ioctl function.
5285 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5286 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5287 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5288 which is driver specific. The <tt/code/ parameter will choose between
5289 different IOCTL functions, and the <tt/data/ depends on code. The
5290 function returns an error code. The purpose of this function is to allow
5291 for driver specific extensions. See the documentation for a specific mouse
5292 driver for supported ioctl calls.
5293 <tag/Notes/<itemize>
5294 <item>Calling this function is non portable, because each driver may
5295 implement different ioctl calls (or none at all).
5296 <item>The function is only available as fastcall function, so it may only be
5297 used in presence of a prototype.
5299 <tag/Availability/cc65
5305 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5309 <tag/Function/Load and initialize a mouse driver.
5310 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5311 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5312 mouse_callbacks* c, const char* driver);/
5313 <tag/Description/Load a mouse driver into memory and initialize it. The
5314 function returns an error code that tells if the call has been successful. The
5315 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5316 routines needed to move or hide/show the mouse pointer. Defaults for these
5317 routines are supplied by the library, so if you can live with these defaults
5318 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5319 <tag/Notes/<itemize>
5320 <item>The driver is loaded by name, so currently you must know the type of
5321 mouse that should be supported. There is no autodetect capability.
5322 <item>Not all drivers are able to detect if the supported hardware is really
5324 <item>After installing a driver, the mouse cursor is hidden.
5325 <item>The function is only available as fastcall function, so it may only be
5326 used in presence of a prototype.
5328 <tag/Availability/cc65
5330 <ref id="mouse_install" name="mouse_install">,
5331 <ref id="mouse_uninstall" name="mouse_uninstall">,
5332 <ref id="mouse_unload" name="mouse_unload">
5338 <sect1>mouse_move<label id="mouse_move"><p>
5342 <tag/Function/Move the mouse cursor to a specific position.
5343 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5344 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5345 <tag/Description/The function updates the mouse position. If the mouse cursor
5346 is visible, it is shown at the new position.
5347 <tag/Notes/<itemize>
5348 <item>The function does not check if the new position is within the bounding
5349 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
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_getbox" name="mouse_getbox">,
5356 <ref id="mouse_setbox" name="mouse_setbox">
5362 <sect1>mouse_pos<label id="mouse_pos"><p>
5366 <tag/Function/Return the position of the mouse.
5367 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5368 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5369 <tag/Description/The function returns the position of the mouse in the
5370 <tt/mouse_pos/ structure passed as parameter.
5371 <tag/Notes/<itemize>
5372 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5373 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5374 name="mouse_info">/ instead.
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_buttons" name="mouse_buttons">,
5381 <ref id="mouse_info" name="mouse_info">
5387 <sect1>mouse_show<label id="mouse_show"><p>
5391 <tag/Function/Show the mouse pointer.
5392 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5393 <tag/Declaration/<tt/void mouse_show (void);/
5394 <tag/Description/The function shows the mouse pointer. It manages a counter
5395 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5396 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5397 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5398 <tag/Availability/cc65
5400 <ref id="mouse_hide" name="mouse_hide">
5406 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5410 <tag/Function/Uninstall an already loaded mouse driver.
5411 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5412 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5413 <tag/Description/The function uninstalls an already loaded mouse driver but
5414 don't removes it from memory.
5415 <tag/Notes/<itemize>
5416 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5417 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5418 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5421 <tag/Availability/cc65
5423 <ref id="mouse_install" name="mouse_install">,
5424 <ref id="mouse_load_driver" name="mouse_load_driver">,
5425 <ref id="mouse_unload" name="mouse_unload">
5431 <sect1>mouse_unload<label id="mouse_unload"><p>
5435 <tag/Function/Unload a mouse driver.
5436 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5437 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5438 <tag/Description/The function unloads a loaded mouse driver and frees all
5439 memory allocated for the driver.
5440 <tag/Notes/<itemize>
5441 <item>The function does nothing if no driver is loaded.
5443 <tag/Availability/cc65
5445 <ref id="mouse_install" name="mouse_install">,
5446 <ref id="mouse_load_driver" name="mouse_load_driver">,
5447 <ref id="mouse_uninstall" name="mouse_uninstall">
5453 <sect1>offsetof<label id="offsetof"><p>
5457 <tag/Function/Calculate the offset of a struct or union member.
5458 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5459 <tag/Declaration/<tt/size_t offsetof (type, member);/
5460 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5461 or <tt/union/ member.
5462 <tag/Notes/<itemize>
5463 <item>The function is actually a macro.
5465 <tag/Availability/ISO 9899
5471 <sect1>open<label id="open"><p>
5475 <tag/Function/Open and possibly create a file.
5476 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5477 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5478 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5479 associated with it. On error, -1 is returned and an error code is stored in
5480 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5481 <tag/Notes/<itemize>
5482 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5483 open, which is used as the permission mask when a new file is created. While
5484 cc65 allows to pass this argument, it is ignored.
5486 <tag/Availability/POSIX 1003.1
5488 <ref id="close" name="close">,
5489 <ref id="creat" name="creat">
5495 <sect1>opendir<label id="opendir"><p>
5499 <tag/Function/Open a directory.
5500 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5501 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5502 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5503 descriptor associated with it. On error, NULL is returned and an error code is
5504 stored in <tt/errno/.
5505 <tag/Notes/<itemize>
5506 <item>The function is only available as fastcall function, so it may only
5507 be used in presence of a prototype.
5509 <tag/Availability/POSIX 1003.1
5511 <ref id="closedir" name="closedir">,
5512 <ref id="readdir" name="readdir">
5518 <sect1>peekbsys<label id="peekbsys"><p>
5522 <tag/Function/Read one byte from a location in the system bank.
5523 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5524 <tt/<ref id="cbm510.h" name="cbm510.h">/
5525 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5526 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5527 system bank (bank 15) of the CBM PET-II machines and returns it.
5528 <tag/Notes/<itemize>
5529 <item>The function is only available as fastcall function, so it may only
5530 be used in presence of a prototype.
5531 <item>This function may be a macro depending on the compiler options. The
5532 actual function is accessible by #undef'ing the macro.
5534 <tag/Availability/cc65
5536 <ref id="PEEK" name="PEEK">,
5537 <ref id="PEEKW" name="PEEKW">,
5538 <ref id="peekwsys" name="peekwsys">,
5539 <ref id="pokebsys" name="pokebsys">,
5540 <ref id="pokewsys" name="pokewsys">
5546 <sect1>peekwsys<label id="peekwsys"><p>
5550 <tag/Function/Read one word from a location in the system bank.
5551 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5552 <tt/<ref id="cbm510.h" name="cbm510.h">/
5553 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5554 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5555 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5556 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5557 high byte is read from <tt/addr+1/.
5558 <tag/Notes/<itemize>
5559 <item>The function is only available as fastcall function, so it may only
5560 be used in presence of a prototype.
5561 <item>The order in which the two bytes are read is undefined.
5563 <tag/Availability/cc65
5565 <ref id="PEEK" name="PEEK">,
5566 <ref id="PEEKW" name="PEEKW">,
5567 <ref id="peekbsys" name="peekbsys">,
5568 <ref id="pokebsys" name="pokebsys">,
5569 <ref id="pokewsys" name="pokewsys">
5575 <sect1>perror<label id="perror"><p>
5579 <tag/Function/Print an error message for the error in <tt/errno/.
5580 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5581 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5582 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5583 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5584 a blank. Then the error message for the current contents of <tt/errno/ is
5585 printed followed by a newline. The message output is the same as returned by
5586 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5587 <tag/Notes/<itemize>
5588 <item>The function is only available as fastcall function, so it may only
5589 be used in presence of a prototype.
5591 <tag/Availability/ISO 9899
5593 <ref id="_poserror" name="_poserror">,
5594 <ref id="strerror" name="strerror">
5600 <sect1>pokebsys<label id="pokebsys"><p>
5604 <tag/Function/Write one byte to a location in the system bank.
5605 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5606 <tt/<ref id="cbm510.h" name="cbm510.h">/
5607 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5608 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5609 system bank (bank 15) of the CBM PET-II machines.
5610 <tag/Notes/<itemize>
5611 <item>The function is only available as fastcall function, so it may only
5612 be used in presence of a prototype.
5614 <tag/Availability/cc65
5616 <ref id="POKE" name="POKE">,
5617 <ref id="POKEW" name="POKEW">,
5618 <ref id="peekbsys" name="peekbsys">,
5619 <ref id="peekwsys" name="peekwsys">,
5620 <ref id="pokewsys" name="pokewsys">
5626 <sect1>pokewsys<label id="pokewsys"><p>
5630 <tag/Function/Write one word to a location in the system bank.
5631 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5632 <tt/<ref id="cbm510.h" name="cbm510.h">/
5633 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5634 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5635 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5636 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5637 high byte is written to <tt/addr+1/.
5638 <tag/Notes/<itemize>
5639 <item>The function is only available as fastcall function, so it may only
5640 be used in presence of a prototype.
5641 <item>The order in which the two bytes are written is undefined.
5643 <tag/Availability/cc65
5645 <ref id="POKE" name="POKE">,
5646 <ref id="POKEW" name="POKEW">,
5647 <ref id="peekbsys" name="peekbsys">,
5648 <ref id="peekwsys" name="peekwsys">,
5649 <ref id="pokebsys" name="pokebsys">
5655 <sect1>qsort<label id="qsort"><p>
5659 <tag/Function/Sort an array.
5660 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5661 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5662 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5663 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5664 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5665 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5666 the function used to compare the members.
5667 <tag/Notes/<itemize>
5668 <item>If there are multiple members with the same key, the order after calling
5669 the function is undefined.
5670 <item>The function is only available as fastcall function, so it may only
5671 be used in presence of a prototype.
5672 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5675 <tag/Availability/ISO 9899
5677 <ref id="bsearch" name="bsearch">
5683 <sect1>raise<label id="raise"><p>
5687 <tag/Function/Send a signal to the executing program.
5688 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5689 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5690 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5691 program has installed a signal handler for the signal, this signal handler
5692 will be executed. If no handler has been installed, the default action for
5693 the raised signal will be taken. The function returns zero on success,
5695 <tag/Notes/<itemize>
5696 <item>The function is only available as fastcall function, so it may only
5697 be used in presence of a prototype.
5699 <tag/Availability/ISO 9899
5701 <ref id="abort" name="abort">,
5702 <ref id="signal" name="signal">
5708 <sect1>rand<label id="rand"><p>
5712 <tag/Function/Return a pseudo random number.
5713 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5714 <tag/Declaration/<tt/int rand (void);/
5715 <tag/Description/The function returns a pseudo random number
5716 between 0 and <tt/RAND_MAX/ (exclusive).
5717 <tag/Notes/<itemize>
5718 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5719 flow of numbers is generated.
5720 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5721 had been used with an argument of 1.
5723 <tag/Availability/ISO 9899
5725 <ref id="_randomize" name="_randomize">,
5726 <ref id="srand" name="srand">
5732 <sect1>readdir<label id="readdir"><p>
5736 <tag/Function/Read a directory.
5737 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5738 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5739 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5740 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5741 and returns a pointer to it. If the end of directory is reached, or an error
5742 occurs, NULL is returned. In case of errors, an error code is stored into
5744 <tag/Notes/<itemize>
5745 <item>The function is only available as fastcall function, so it may only
5746 be used in presence of a prototype.
5747 <item>The returned pointer may point to a statically allocated instance of
5748 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5750 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5751 confused when opening/closing files between directory reads. So for example a
5752 program that reads the list of files on a disk, and after each call to
5753 <tt/readdir/, opens the file to process it, will fail.<newline>
5754 Possible solutions are reading the directory into memory before processing the
5755 file list, or to reset the directory by seeking to the correct position after
5756 opening/closing a file:
5758 seekdir (DIR, telldir (DIR));
5760 Platforms known to work without problems are: Apple.
5762 <tag/Availability/POSIX 1003.1
5764 <ref id="closedir" name="closedir">,
5765 <ref id="opendir" name="opendir">
5771 <sect1>realloc<label id="realloc"><p>
5775 <tag/Function/Change the size of an allocated memory block.
5776 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5777 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5778 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5779 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5780 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5781 behaves as if <tt/free/ had been called. On error (not enough memory
5782 available), <tt/realloc/ returns <tt/NULL/.
5783 <tag/Notes/<itemize>
5784 <item>The part of the memory block that is returned will have its contents
5786 <item>This function is somewhat dangerous to use. Be careful to save the
5787 pointer you're passing somewhere else, otherwise
5789 ptr = realloc (ptr, size);
5791 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5792 <item>The function is only available as fastcall function, so it may only
5793 be used in presence of a prototype.
5795 <tag/Availability/ISO 9899
5797 <ref id="_heapadd" name="_heapadd">,
5798 <ref id="_heapblocksize" name="_heapblocksize">,
5799 <ref id="_heapmaxavail" name="_heapmaxavail">,
5800 <ref id="_heapmemavail" name="_heapmemavail">,
5801 <ref id="calloc" name="calloc">,
5802 <ref id="free" name="free">,
5803 <ref id="realloc" name="realloc">
5809 <sect1>remove<label id="remove"><p>
5813 <tag/Function/Delete a file.
5814 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5815 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5816 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5817 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5818 code describing the reason for the failure.
5819 <tag/Notes/<itemize>
5820 <item>This function is not available on all cc65 targets (depends on the
5821 availability of file I/O).
5822 <item>The function is only available as fastcall function, so it may only
5823 be used in presence of a prototype.
5825 <tag/Availability/ISO 9899
5827 <ref id="rename" name="rename">,
5828 <ref id="unlink" name="unlink">
5831 #include <stdio.h>
5833 #define FILENAME "helloworld"
5835 if (remove (FILENAME) == 0) {
5836 printf ("We deleted %s successfully\n", FILENAME);
5838 printf ("There was a problem deleting %s\n", FILENAME);
5845 <sect1>rename<label id="rename"><p>
5849 <tag/Function/Rename a file.
5850 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5851 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5852 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5853 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5854 code describing the reason for the failure.
5855 <tag/Notes/<itemize>
5856 <item>This function is not available on all cc65 targets (depends on the
5857 capabilities of the storage devices).
5858 <item>The function is only available as fastcall function, so it may only
5859 be used in presence of a prototype.
5861 <tag/Availability/ISO 9899
5863 <ref id="remove" name="remove">
5866 #include <stdio.h>
5868 #define OLDNAME "textfile.txt"
5869 #define NEWNAME "textfile.bak"
5871 if (rename (OLDNAME, NEWNAME) == 0) {
5872 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5874 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5881 <sect1>reset_brk<label id="reset_brk"><p>
5885 <tag/Function/Resets the break vector to its original value.
5886 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5887 <tag/Declaration/<tt/void reset_brk (void);/
5888 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5889 before a call to <tt/set_brk/.
5890 <tag/Notes/<itemize>
5891 <item>The break vector is reset on program termination, so it's not strictly
5892 necessary to call this function as a part of your clean-up when exiting the program.
5894 <tag/Availability/cc65
5896 <ref id="reset_irq" name="reset_irq">,
5897 <ref id="set_brk" name="set_brk">,
5898 <ref id="set_irq" name="set_irq">
5904 <sect1>reset_irq<label id="reset_irq"><p>
5908 <tag/Function/Resets the C level interrupt request vector.
5909 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5910 <tag/Declaration/<tt/void reset_irq (void);/
5911 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5912 <tag/Notes/<itemize>
5913 <item>The interrupt vector is reset on program termination, so it's not strictly
5914 necessary to call this function as a part of your clean-up when exiting the program.
5916 <tag/Availability/cc65
5918 <ref id="reset_brk" name="reset_brk">,
5919 <ref id="set_brk" name="set_brk">,
5920 <ref id="set_irq" name="set_irq">
5926 <sect1>revers<label id="revers"><p>
5930 <tag/Function/Control revers character display.
5931 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5932 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5933 <tag/Description/If the argument is non zero, the function enables reverse
5934 character display. If the argument is zero, reverse character display is
5935 switched off. The old value of the setting is returned.
5936 <tag/Notes/<itemize>
5937 <item>The function may not be supported by the hardware, in which case
5938 the call is ignored.
5939 <item>The function is only available as fastcall function, so it may only
5940 be used in presence of a prototype.
5942 <tag/Availability/cc65
5944 <ref id="textcolor" name="textcolor">
5950 <sect1>rewinddir<label id="rewinddir"><p>
5954 <tag/Function/Reset a directory stream.
5955 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5956 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5957 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5958 pointed to by <tt/dir/ to the start of the directory.
5959 <tag/Notes/<itemize>
5960 <item>The function is only available as fastcall function, so it may only
5961 be used in presence of a prototype.
5963 <tag/Availability/POSIX 1003.1
5965 <ref id="seekdir" name="seekdir">,
5966 <ref id="telldir" name="telldir">
5972 <sect1>screensize<label id="screensize"><p>
5976 <tag/Function/Return the dimensions of the text mode screen.
5977 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5978 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5979 <tag/Description/The function returns the dimensions of the text mode screen.
5980 <tag/Notes/<itemize>
5981 <item>The function is only available as fastcall function, so it may only
5982 be used in presence of a prototype.
5984 <tag/Availability/cc65
5986 <ref id="gotox" name="gotox">,
5987 <ref id="gotoxy" name="gotoxy">,
5988 <ref id="gotoy" name="gotoy">,
5989 <ref id="wherex" name="wherex">,
5990 <ref id="wherey" name="wherey">
5996 <sect1>seekdir<label id="seekdir"><p>
6000 <tag/Function/Set the position of a directory stream.
6001 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6002 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
6003 <tag/Description/<tt/seekdir/ sets the position of the directory stream
6004 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
6005 value returned by <tt/<ref id="telldir" name="telldir">/.
6006 <tag/Notes/<itemize>
6007 <item>The function is only available as fastcall function, so it may only
6008 be used in presence of a prototype.
6010 <tag/Availability/POSIX 1003.1
6012 <ref id="rewinddir" name="rewinddir">,
6013 <ref id="telldir" name="telldir">
6019 <sect1>ser_close<label id="ser_close"><p>
6023 <tag/Function/Close the port and disable interrupts
6024 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6025 <tag/Declaration/<tt/unsigned char ser_close (void);/
6026 <tag/Description/Close the port by clearing buffers and disable interrupts.
6027 <tag/Availability/cc65
6028 <tag/See also/Other serial functions.
6033 static void initialize(){
6034 struct ser_params params = {
6041 ser_install(lynx_comlynx); // This will activate the ComLynx
6043 ser_open(&params);
6050 <sect1>ser_get<label id="ser_get"><p>
6054 <tag/Function/Read a character from serial port.
6055 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6056 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
6057 <tag/Description/Get a character from the serial port. If no characters are
6058 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
6060 <tag/Notes/<itemize>
6061 <item>The function is only available as fastcall function, so it may only
6062 be used in presence of a prototype.
6064 <tag/Availability/cc65
6065 <tag/See also/Other serial functions.
6067 Wait for a character to be available from a serial port.
6070 while (ser_get(&ch) == SER_ERR_NO_DATA)
6077 <sect1>ser_install<label id="ser_install"><p>
6081 <tag/Function/Install an already loaded driver and return an error code.
6082 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6083 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
6084 <tag/Description/The function installs a driver that was already loaded into
6085 memory (or linked statically to the program). It returns an error code
6086 (<tt/SER_ERR_OK/ in case of success).
6087 <tag/Notes/<itemize>
6088 <item>The function is only available as fastcall function, so it may only be
6089 used in presence of a prototype.
6091 <tag/Availability/cc65
6093 <ref id="ser_load_driver" name="ser_load_driver">,
6094 <ref id="ser_uninstall" name="ser_uninstall">,
6095 <ref id="ser_unload" name="ser_unload">
6097 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
6103 <sect1>ser_ioctl<label id="ser_ioctl"><p>
6107 <tag/Function/Platform dependent code extensions.
6108 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6109 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
6110 <tag/Description/Some platforms have extra serial functions that are not
6111 supported by standard serial driver functions. You can extend the driver to support
6112 this extra functionality bt using ser_ioctl functions.
6113 <tag/Notes/<itemize>
6114 <item>The function is only available as fastcall function, so it may only
6115 be used in presence of a prototype.
6116 <item>These functions are not easily portable to other cc65 platforms.
6118 <tag/Availability/cc65
6119 <tag/See also/Other serial functions.
6124 <sect1>ser_load_driver<label id="ser_load_driver"><p>
6128 <tag/Function/Load and install a serial driver.
6129 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6130 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
6131 <tag/Description/Load and install the driver by name.
6132 Will just load the driver and check if loading was successful.
6133 <tag/Notes/<itemize>
6134 <item>The function is only available as fastcall function, so it may only
6135 be used in presence of a prototype.
6137 <tag/Availability/cc65
6138 <tag/See also/Other serial functions.
6144 <sect1>ser_open<label id="ser_open"><p>
6148 <tag/Function/Open the port by setting the port parameters and enable interrupts
6149 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6150 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
6151 <tag/Description/Open the port by setting the port parameters and enable interrupts.
6152 <tag/Notes/<itemize>
6153 <item>The function is only available as fastcall function, so it may only
6154 be used in presence of a prototype.
6156 <tag/Availability/cc65
6157 <tag/See also/Other serial functions.
6162 static void initialize(){
6163 struct ser_params params = {
6170 ser_install(lynx_comlynx); // This will activate the ComLynx
6172 ser_open(&params);
6179 <sect1>ser_put<label id="ser_put"><p>
6183 <tag/Function/Write a character to a serial port.
6184 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6185 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
6186 <tag/Description/Send a character via the serial port. There is a transmit
6187 buffer, but transmitting is not done via interrupt. The function returns
6188 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
6189 <tag/Notes/<itemize>
6190 <item>The function is only available as fastcall function, so it may only
6191 be used in presence of a prototype.
6193 <tag/Availability/cc65
6194 <tag/See also/Other serial functions.
6203 <sect1>ser_status<label id="ser_status"><p>
6207 <tag/Function/Return the serial port status.
6208 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6209 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
6210 <tag/Description/Return the serial port status.
6211 <tag/Notes/<itemize>
6212 <item>The function is only available as fastcall function, so it may only
6213 be used in presence of a prototype.
6215 <tag/Availability/cc65
6216 <tag/See also/Other serial functions.
6222 <sect1>ser_uninstall<label id="ser_uninstall"><p>
6226 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6227 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6228 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
6229 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6230 <tag/Availability/cc65
6231 <tag/See also/Other serial functions.
6236 <sect1>ser_unload<label id="ser_unload"><p>
6240 <tag/Function/Uninstall, then unload the currently loaded driver.
6241 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6242 <tag/Declaration/<tt/unsigned char ser_unload (void);/
6243 <tag/Description/Uninstall, then unload the currently loaded driver.
6244 <tag/Availability/cc65
6245 <tag/See also/Other serial functions.
6251 <sect1>set_brk<label id="set_brk"><p>
6255 <tag/Function/Set the break vector to a user function.
6256 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6257 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
6258 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
6259 program code by letting the vector point to a user written C function. The
6260 runtime library installs a small stub that saves the registers into global
6261 variables that may be accessed (and changed) by the break handler.
6262 <tag/Notes/<itemize>
6263 <item>The function is only available as fastcall function, so it may only
6264 be used in presence of a prototype.
6265 <item>The stub saves the zero page registers used by the C runtime and switches
6266 to a small break handler stack. This means that it is safe to execute C code,
6267 even if C code was interrupted. Be careful however not to use too many local
6268 variables, and do not enable stack checks for the handler function or any other
6269 function called from it.
6270 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6271 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6272 otherwise the <tt/BRK/ instruction will get executed over and over again.
6273 <item>The break vector is reset on program termination, so it's not strictly
6274 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6275 clean-up when exiting the program.
6277 <tag/Availability/cc65
6279 <ref id="reset_brk" name="reset_brk">
6285 <sect1>set_irq<label id="set_irq"><p>
6289 <tag/Function/Set the C level interrupt request vector to the given address.
6290 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6291 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6292 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6293 (IRQs) within the program code by letting the vector point to a user written C
6294 function. The runtime library installs a small stub that saves the zero page
6295 registers used by the C runtime before calling the handler function and restores
6296 them after the handler function returns. Additionally the stub temporarily switches
6297 the C runtime stack to the stack area provided as parameter. If the handler function
6298 was set up to handle a "private", "exclusive" interrupt request source it must
6299 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6300 interrupt request actually stems from that source. In all other cases it must return
6301 the value <tt/IRQ_NOT_HANDLED/.
6302 <tag/Notes/<itemize>
6303 <item>The function is only available as fastcall function, so it may only
6304 be used in presence of a prototype.
6305 <item>The stub saves the registers and zero page locations used by the C runtime
6306 and switches to the provided stack area. As a consequence, there is some
6307 runtime overhead, but it it is safe to execute C code, even if other C code
6308 was interrupted. Be careful however not to call C library functions, and do not
6309 enable stack checks for the handler function or any other function called from
6311 <item>The interrupt vector is reset on program termination, so it's not strictly
6312 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6313 clean-up when exiting the program.
6315 <tag/Availability/cc65
6317 <ref id="reset_brk" name="reset_brk">,
6318 <ref id="reset_irq" name="reset_irq">,
6319 <ref id="set_brk" name="set_brk">
6325 <sect1>set_c128_speed<label id="set_c128_speed"><p>
6329 <tag/Function/Set the current speed of a C128 CPU.
6330 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6331 <tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/
6332 <tag/Description/The function returns the speed after trying to set the speed of the C128 CPU.
6333 <tag/Notes/<itemize>
6334 <item>The function is specific to the C64 and C128.
6335 <item>The function does not check if the C128 CPU is the current CPU.
6336 <item>See the accelerator.h header for the speed definitions.
6338 <tag/Availability/cc65 (not all platforms)
6340 <ref id="detect_c128" name="detect_c128">,
6341 <ref id="get_c128_speed" name="get_c128_speed">,
6347 <sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p>
6351 <tag/Function/Set the current speed of the C64DTV.
6352 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6353 <tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/
6354 <tag/Description/The function returns the speed after trying to set the speed of the C64DTV.
6355 <tag/Notes/<itemize>
6356 <item>The function is specific to the C64.
6357 <item>The function does not check for the presence of the C64DTV.
6358 <item>See the accelerator.h header for the speed definitions.
6360 <tag/Availability/cc65 (not all platforms)
6362 <ref id="detect_c64dtv" name="detect_c64dtv">,
6363 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
6369 <sect1>set_c65_speed<label id="set_c65_speed"><p>
6373 <tag/Function/Set the current speed of the C65/C64DX in C64 mode.
6374 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6375 <tag/Declaration/<tt/unsigned char __fastcall__ set_c65_speed (unsigned char speed);/
6376 <tag/Description/The function returns the speed after trying to set the speed of the C65/C64DX in C64 mode.
6377 <tag/Notes/<itemize>
6378 <item>The function is specific to the C64.
6379 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
6380 <item>See the accelerator.h header for the speed definitions.
6382 <tag/Availability/cc65 (not all platforms)
6384 <ref id="detect_c65" name="detect_c65">,
6385 <ref id="get_c65_speed" name="get_c65_speed">,
6391 <sect1>set_chameleon_speed<label id="set_chameleon_speed"><p>
6395 <tag/Function/Set the current speed of the C64 Chameleon cartridge.
6396 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6397 <tag/Declaration/<tt/unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);/
6398 <tag/Description/The function returns the speed after trying to set the speed of the C64 Chameleon cartridge.
6399 <tag/Notes/<itemize>
6400 <item>The function is specific to the C64.
6401 <item>The function does not check for the presence of the C64 Chameleon cartridge.
6402 <item>See the accelerator.h header for the speed definitions.
6404 <tag/Availability/cc65 (not all platforms)
6406 <ref id="detect_chameleon" name="detect_chameleon">,
6407 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
6413 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6417 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6418 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6419 <tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/
6420 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6421 <tag/Notes/<itemize>
6422 <item>The function is specific to the C128 and C64.
6423 <item>The function does not check for the presence of the cartridge.
6424 <item>See the accelerator.h header for the speed definitions.
6426 <tag/Availability/cc65 (not all platforms)
6428 <ref id="detect_scpu" name="detect_scpu">,
6429 <ref id="get_scpu_speed" name="get_scpu_speed">,
6435 <sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p>
6439 <tag/Function/Set the current speed of the C64 Turbo Master cartridge.
6440 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6441 <tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/
6442 <tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge.
6443 <tag/Notes/<itemize>
6444 <item>The function is specific to the C64.
6445 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
6446 <item>See the accelerator.h header for the speed definitions.
6448 <tag/Availability/cc65 (not all platforms)
6450 <ref id="detect_turbomaster" name="detect_turbomaster">,
6451 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
6457 <sect1>setjmp<label id="setjmp"><p>
6461 <tag/Function/Save the context for use with <tt/longjmp/.
6462 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6463 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6464 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6465 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6467 <tag/Notes/<itemize>
6468 <item>The function is only available as fastcall function, so it may only
6469 be used in presence of a prototype.
6470 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6471 <item><tt/setjmp/ will not save the signal context.
6473 <tag/Availability/ISO 9899
6475 <ref id="longjmp" name="longjmp">
6481 <sect1>setlocale<label id="setlocale"><p>
6485 <tag/Function/Selects a locale.
6486 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6487 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6488 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6489 <tag/Notes/<itemize>
6490 <item>The function is only available as fastcall function, so it may only
6491 be used in presence of a prototype.
6492 <item>cc65 supports only the "C" locale, so calling this function to set a
6493 different locale has no effect.
6495 <tag/Availability/ISO 9899
6497 <ref id="localeconv" name="localeconv">,
6498 <ref id="strcoll" name="strcoll">
6499 <ref id="strxfrm" name="strxfrm">
6505 <sect1>signal<label id="signal"><p>
6509 <tag/Function/Install a signal handler.
6510 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6511 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6512 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6513 handler may either be a user supplied function, or one of the predefined
6514 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6515 previous value if the signal , or the special function vector SIG_ERR in
6517 <tag/Notes/<itemize>
6518 <item>The function is only available as fastcall function, so it may only
6519 be used in presence of a prototype.
6521 <tag/Availability/ISO 9899
6523 <ref id="abort" name="abort">,
6524 <ref id="raise" name="raise">
6530 <sect1>sleep<label id="sleep"><p>
6534 <tag/Function/Sleep for a specified amount of time.
6535 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6536 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6537 <tag/Description/The function will return after the specified number of
6538 seconds have elapsed.
6539 <tag/Notes/<itemize>
6540 <item>The function is only available as fastcall function, so it may only
6541 be used in presence of a prototype.
6543 <tag/Availability/POSIX 1003.1
6549 <sect1>slow<label id="slow"><p>
6553 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6554 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6555 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6556 <tag/Declaration/<tt/void slow (void);/
6557 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6558 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6559 switching the CPU into single clock mode.
6560 <tag/Notes/<itemize>
6561 <item>The function is specific to the C128, C16 and Plus4.
6563 <tag/Availability/cc65 (not all platforms)
6565 <ref id="fast" name="fast">,
6566 <ref id="isfast" name="isfast">,
6572 <sect1>srand<label id="srand"><p>
6576 <tag/Function/Initialize the pseudo random number generator.
6577 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6578 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6579 <tag/Description/The function initializes the random number generator using
6580 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6581 been called with an argument of 1.
6582 <tag/Notes/<itemize>
6583 <item>The function is only available as fastcall function, so it may only
6584 be used in presence of a prototype.
6586 <tag/Availability/ISO 9899
6588 <ref id="_randomize" name="_randomize">,
6589 <ref id="rand" name="rand">
6595 <sect1>strcasecmp<label id="strcasecmp"><p>
6599 <tag/Function/Compare two strings case insensitive.
6600 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6601 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6602 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6603 as parameters without case sensitivity. It returns a value that is less than
6604 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6605 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6606 <tag/Notes/<itemize>
6607 <item>The function is only available as fastcall function, so it may only
6608 be used in presence of a prototype.
6609 <item>The function is not available in strict ANSI mode.
6611 <tag/Availability/cc65
6613 <ref id="strcmp" name="strcmp">,
6614 <ref id="strcoll" name="strcoll">,
6615 <ref id="stricmp" name="stricmp">,
6616 <ref id="strncmp" name="strncmp">,
6617 <ref id="strxfrm" name="strxfrm">
6623 <sect1>strcat<label id="strcat"><p>
6627 <tag/Function/Concatentate two strings.
6628 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6629 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6630 <tag/Description/The <tt/strcat/ function appends a copy of the string
6631 pointed to by s2 (including the terminating null byte) to the end of the
6632 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6634 <tag/Notes/<itemize>
6635 <item>The function is only available as fastcall function, so it may only
6636 be used in presence of a prototype.
6637 <item>If copying takes place between objects that overlap, the behaviour
6640 <tag/Availability/ISO 9899
6642 <ref id="strcpy" name="strcpy">,
6643 <ref id="strncat" name="strncat">,
6644 <ref id="strncpy" name="strncpy">
6650 <sect1>strchr<label id="strchr"><p>
6654 <tag/Function/Search for a character in a string.
6655 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6656 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6657 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6658 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6659 byte is considered to be part of the string. Upon completion, the function
6660 returns a pointer to the byte, or a null pointer if the byte was not found.
6661 <tag/Notes/<itemize>
6662 <item>The function is only available as fastcall function, so it may only
6663 be used in presence of a prototype.
6665 <tag/Availability/ISO 9899
6667 <ref id="memchr" name="memchr">,
6668 <ref id="strrchr" name="strrchr">
6674 <sect1>strcmp<label id="strcmp"><p>
6678 <tag/Function/Compare two strings.
6679 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6680 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6681 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6682 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6683 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6684 if <tt/s1/ is greater than <tt/s2/.
6685 <tag/Notes/<itemize>
6686 <item>The function is only available as fastcall function, so it may only
6687 be used in presence of a prototype.
6689 <tag/Availability/ISO 9899
6691 <ref id="strcasecmp" name="strcasecmp">,
6692 <ref id="strcoll" name="strcoll">,
6693 <ref id="stricmp" name="stricmp">,
6694 <ref id="strncmp" name="strncmp">
6695 <ref id="strxfrm" name="strxfrm">
6701 <sect1>strcoll<label id="strcoll"><p>
6705 <tag/Function/Compare two strings.
6706 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6707 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6708 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6709 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6710 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6711 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6712 than zero if <tt/s1/ is greater than <tt/s2/.
6713 <tag/Notes/<itemize>
6714 <item>The function is only available as fastcall function, so it may only
6715 be used in presence of a prototype.
6717 <tag/Availability/ISO 9899
6719 <ref id="setlocale" name="setlocale">,
6720 <ref id="strcasecmp" name="strcasecmp">,
6721 <ref id="strcmp" name="strcmp">,
6722 <ref id="stricmp" name="stricmp">,
6723 <ref id="strncmp" name="strncmp">,
6724 <ref id="strxfrm" name="strxfrm">
6730 <sect1>strcpy<label id="strcpy"><p>
6734 <tag/Function/Copy a string.
6735 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6736 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6737 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6738 <tt/s2/ (including the terminating null byte) into the array pointed to by
6739 <tt/s1/. The function will always return <tt/s1/.
6740 <tag/Notes/<itemize>
6741 <item>The function is only available as fastcall function, so it may only
6742 be used in presence of a prototype.
6743 <item>If copying takes place between objects that overlap, the behaviour
6746 <tag/Availability/ISO 9899
6748 <ref id="strcat" name="strcat">,
6749 <ref id="strncat" name="strncat">,
6750 <ref id="strncpy" name="strncpy">
6753 #include <string.h>
6755 static char hello[14];
6757 strcpy (hello, "Hello world!\n");
6763 <sect1>strcspn<label id="strcspn"><p>
6767 <tag/Function/Compute the length of a substring.
6768 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6769 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6770 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6771 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6772 characters contained in the string <tt/set/.
6773 <tag/Notes/<itemize>
6774 <item>The function is only available as fastcall function, so it may only
6775 be used in presence of a prototype.
6777 <tag/Availability/ISO 9899
6779 <ref id="strqtok" name="strqtok">,
6780 <ref id="strspn" name="strspn">,
6781 <ref id="strstr" name="strstr">,
6782 <ref id="strtok" name="strtok">
6788 <sect1>strdup<label id="strdup"><p>
6792 <tag/Function/Allocate a copy of a string on the heap.
6793 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6794 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6795 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6796 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6797 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6798 memory block, and a pointer to the block is returned.
6799 <tag/Notes/<itemize>
6800 <item>The function is only available as fastcall function, so it may only
6801 be used in presence of a prototype.
6802 <item>It is up to the caller to free the allocated memory block.
6804 <tag/Availability/ISO 9899
6806 <ref id="free" name="free">,
6807 <ref id="malloc" name="malloc">
6813 <sect1>strerror<label id="strerror"><p>
6817 <tag/Function/Return a string describing an error code.
6818 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6819 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6820 <tag/Description/The <tt/strerror/ function returns a string describing the
6821 given error code. If an invalid error code is passed, the string "Unknown
6822 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6823 <tt/errno/ is left untouched.
6824 <tag/Notes/<itemize>
6825 <item>The function is only available as fastcall function, so it may only
6826 be used in presence of a prototype.
6827 <item>While the return type of the function is a <tt/char*/, the returned
6828 string must not be modified by the caller!
6830 <tag/Availability/ISO 9899
6832 <ref id="_stroserror" name="_stroserror">
6838 <sect1>stricmp<label id="stricmp"><p>
6842 <tag/Function/Compare two strings case insensitive.
6843 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6844 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6845 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6846 parameters without case sensitivity. It returns a value that is less than zero
6847 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6848 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6849 <tag/Notes/<itemize>
6850 <item>The function is only available as fastcall function, so it may only
6851 be used in presence of a prototype.
6852 <item>The function is not available in strict ANSI mode.
6854 <tag/Availability/cc65
6856 <ref id="strcasecmp" name="strcasecmp">,
6857 <ref id="strcmp" name="strcmp">,
6858 <ref id="strcoll" name="strcoll">,
6859 <ref id="strncmp" name="strncmp">,
6860 <ref id="strxfrm" name="strxfrm">
6866 <sect1>strlen<label id="strlen"><p>
6870 <tag/Function/Return the length of a string.
6871 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6872 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6873 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6874 string to which s points, not including the terminating null byte.
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>When compiling with <tt/-Os/ (inline known standard functions), the
6879 function does not work correctly for strings with more than 255 characters.
6881 <tag/Availability/ISO 9899
6883 <ref id="strcpy" name="strcpy">
6889 <sect1>strlower<label id="strlower"><p>
6893 <tag/Function/Make a string lower case.
6894 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6895 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6896 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6897 function to each character of a string. The function will always return <tt/s/.
6898 <tag/Notes/<itemize>
6899 <item>The function is only available as fastcall function, so it may only
6900 be used in presence of a prototype.
6901 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6902 <item>An alias name for this function is <tt/strlwr/.
6904 <tag/Availability/cc65
6906 <ref id="strupper" name="strupper">,
6907 <ref id="tolower" name="tolower">
6913 <sect1>strlwr<label id="strlwr"><p>
6920 <sect1>strncasecmp<label id="strncasecmp"><p>
6924 <tag/Function/Compare two strings case insensitive.
6925 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6926 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6927 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6928 as parameters without case sensitivity. It returns a value that is less than
6929 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6930 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6931 <tag/Notes/<itemize>
6932 <item>The function is only available as fastcall function, so it may only
6933 be used in presence of a prototype.
6934 <item>The function is not available in strict ANSI mode.
6936 <tag/Availability/cc65
6938 <ref id="strcmp" name="strcmp">,
6939 <ref id="strcoll" name="strcoll">,
6940 <ref id="stricmp" name="stricmp">,
6941 <ref id="strncmp" name="strncmp">,
6942 <ref id="strxfrm" name="strxfrm">
6948 <sect1>strncat<label id="strncat"><p>
6952 <tag/Function/Concatentate two strings.
6953 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6954 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6955 <tag/Description/The <tt/strncat/ function appends not more than n characters
6956 of the string pointed to by s2 to the end of the string pointed to by s1. The
6957 terminating null character at the end of s1 is overwritten. A terminating null
6958 character is appended to the result, even if not all of s2 is appended to s1.
6959 <tag/Notes/<itemize>
6960 <item>The function is only available as fastcall function, so it may only
6961 be used in presence of a prototype.
6962 <item>If copying takes place between objects that overlap, the behaviour
6965 <tag/Availability/ISO 9899
6967 <ref id="strcpy" name="strcpy">,
6968 <ref id="strncat" name="strncat">,
6969 <ref id="strncpy" name="strncpy">
6975 <sect1>strncmp<label id="strncmp"><p>
6979 <tag/Function/Compare two strings.
6980 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6981 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6982 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6983 characters of the two strings passed as parameters. It returns a value that is
6984 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6985 <tt/s2/, zero if they are identical, and a value greater than zero they are
6987 <tag/Notes/<itemize>
6988 <item>The function is only available as fastcall function, so it may only
6989 be used in presence of a prototype.
6991 <tag/Availability/ISO 9899
6993 <ref id="strcasecmp" name="strcasecmp">,
6994 <ref id="strcmp" name="strcmp">,
6995 <ref id="strcoll" name="strcoll">,
6996 <ref id="stricmp" name="stricmp">,
6997 <ref id="strxfrm" name="strxfrm">
7003 <sect1>strncpy<label id="strncpy"><p>
7007 <tag/Function/Copy part of a string.
7008 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7009 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
7010 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
7011 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
7012 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
7013 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
7014 written. The function always will return <tt/s1/.
7015 <tag/Notes/<itemize>
7016 <item>The function is available only as a fastcall function; so, it may be used
7017 only in the presence of a prototype.
7018 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
7019 to by <tt/s2/, the result is <em/not/ null-terminated!
7020 <item>If copying takes place between objects that overlap, the behaviour is
7023 <tag/Availability/ISO 9899
7025 <ref id="memcpy" name="memcpy">,
7026 <ref id="strcat" name="strcat">,
7027 <ref id="strcpy" name="strcpy">,
7028 <ref id="strncat" name="strncat">
7033 static char hello[6];
7035 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
7041 <sect1>strnicmp<label id="strnicmp"><p>
7045 <tag/Function/Compare two strings case insensitive.
7046 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7047 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
7048 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
7049 parameters without case sensitivity. It returns a value that is less than zero
7050 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
7051 value greater than zero if <tt/s1/ is greater than <tt/s2/.
7052 <tag/Notes/<itemize>
7053 <item>The function is only available as fastcall function, so it may only
7054 be used in presence of a prototype.
7055 <item>The function is not available in strict ANSI mode.
7057 <tag/Availability/cc65
7059 <ref id="strcasecmp" name="strcasecmp">,
7060 <ref id="strcmp" name="strcmp">,
7061 <ref id="strcoll" name="strcoll">,
7062 <ref id="strncmp" name="strncmp">,
7063 <ref id="strxfrm" name="strxfrm">
7069 <sect1>strqtok<label id="strqtok"><p>
7073 <tag/Function/Break a string into tokens.
7074 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7075 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
7076 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
7077 tokens, which are delimited by either quotation marks or characters from the
7078 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
7079 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
7080 pointer to the first token in the string <tt/s1/. The following calls must pass
7081 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
7082 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
7083 <tag/Notes/<itemize>
7084 <item>The function is available only as a fastcall function; so, it may be used
7085 only in the presence of a prototype.
7086 <item><tt/strqtok()/ will modify the string <tt/s1/.
7087 <item>The function will forget where it is in the <tt/s1/ string if it is given
7088 a second <tt/s1/ string before it finishes the first one.
7090 <tag/Availability/cc65
7092 <ref id="strcspn" name="strcspn">,
7093 <!-- <ref id="strpbrk" name="strpbrk">, -->
7094 <ref id="strspn" name="strspn">,
7095 <ref id="strtok" name="strtok">
7101 <sect1>strrchr<label id="strrchr"><p>
7105 <tag/Function/Search for a character in a string.
7106 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7107 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
7108 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
7109 (converted to a char) in the string pointed to by <tt/s/. The terminating null
7110 byte is considered to be part of the string. Upon completion, the function
7111 returns a pointer to the byte, or a null pointer if the byte was not found.
7112 <tag/Notes/<itemize>
7113 <item>The function is only available as fastcall function, so it may only
7114 be used in presence of a prototype.
7116 <tag/Availability/ISO 9899
7118 <ref id="strchr" name="strchr">
7124 <sect1>strspn<label id="strspn"><p>
7128 <tag/Function/Compute the length of a substring.
7129 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7130 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
7131 <tag/Description/The <tt/strspn/ function computes and returns the length of
7132 the substring pointed to by <tt/s/ which does consist only of characters
7133 contained in the string <tt/set/.
7134 <tag/Notes/<itemize>
7135 <item>The function is only available as fastcall function, so it may only
7136 be used in presence of a prototype.
7138 <tag/Availability/ISO 9899
7140 <ref id="strcspn" name="strcspn">,
7141 <ref id="strstr" name="strstr">
7147 <sect1>strstr<label id="strstr"><p>
7151 <tag/Function/Find a substring.
7152 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7153 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
7154 <tag/Description/<tt/strstr/ searches for the first occurance of the string
7155 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
7156 otherwise it returns <tt/NULL/.
7157 <tag/Notes/<itemize>
7158 <item>The function is only available as fastcall function, so it may only
7159 be used in presence of a prototype.
7161 <tag/Availability/ISO 9899
7163 <ref id="strcspn" name="strcspn">,
7164 <ref id="strspn" name="strspn">
7170 <sect1>strtok<label id="strtok"><p>
7174 <tag/Function/Break a string into tokens.
7175 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7176 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
7177 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
7178 tokens, which are delimited by characters from the string <tt/s2/. The first call
7179 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
7180 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
7181 the next token in the string. Different sets of delimiters may be used for the
7182 subsequent calls to <tt/strtok()/.
7183 <tag/Notes/<itemize>
7184 <item>The function is only available as fastcall function, so it may only
7185 be used in presence of a prototype.
7186 <item><tt/strtok()/ will modify the string <tt/s1/.
7187 <item>The function will forget where it is in the <tt/s1/ string if it is given
7188 a second <tt/s1/ string before it finishes the first one.
7190 <tag/Availability/ISO 9899
7192 <ref id="strcspn" name="strcspn">,
7193 <!-- <ref id="strpbrk" name="strpbrk">, -->
7194 <ref id="strqtok" name="strqtok">,
7195 <ref id="strspn" name="strspn">
7201 <sect1>strxfrm<label id="strxfrm"><p>
7205 <tag/Function/Transform a string.
7206 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7207 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
7208 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
7209 s2 and places the resulting string into the string pointed to by s1. The
7210 transformation is such that if the <tt/strcmp/ function is applied to two
7211 transformed strings, it returns a value greater than, equal to, or less than
7212 zero, corresponding to the result of the <tt/strcoll/ function applied to the
7213 same two original strings. No more than n characters are placed into the
7214 resulting array pointed to by s1, including the terminating null character.
7215 <tag/Notes/<itemize>
7216 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
7217 the behaviour is undefined.
7218 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
7219 <item>The function is only available as fastcall function, so it may only
7220 be used in presence of a prototype.
7221 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
7222 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
7224 <tag/Availability/ISO 9899
7226 <ref id="strcmp" name="strcmp">,
7227 <ref id="strcoll" name="strcoll">,
7228 <ref id="strncpy" name="strncpy">
7234 <sect1>strupper<label id="strupper"><p>
7238 <tag/Function/Make a string upper case.
7239 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7240 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
7241 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
7242 function to each character of a string. The function will always return <tt/s/.
7243 <tag/Notes/<itemize>
7244 <item>The function is only available as fastcall function, so it may only
7245 be used in presence of a prototype.
7246 <item>The function prototype is unavailable when compiling in strict ANSI mode.
7247 <item>An alias name for this function is <tt/strupr/.
7249 <tag/Availability/cc65
7251 <ref id="strlower" name="strlower">
7252 <ref id="toupper" name="toupper">
7258 <sect1>strupr<label id="strupr"><p>
7265 <sect1>telldir<label id="telldir"><p>
7269 <tag/Function/Return the current position of a directory stream.
7270 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
7271 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
7272 <tag/Description/<tt/telldir/ returns the current position of a directory
7273 stream. The return value may be used in subsequent calls to
7274 <tt/<ref id="seekdir" name="seekdir">/.
7275 <tag/Notes/<itemize>
7276 <item>The function is only available as fastcall function, so it may only
7277 be used in presence of a prototype.
7279 <tag/Availability/POSIX 1003.1
7281 <ref id="seekdir" name="seekdir">,
7282 <ref id="telldir" name="telldir">
7288 <sect1>textcolor<label id="textcolor"><p>
7292 <tag/Function/Set the text color.
7293 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7294 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
7295 <tag/Description/The function will set a new text color. It returns the old
7296 (current) text color. Text output using any <tt/conio.h/ function will use
7297 the color set by this function.
7298 <tag/Notes/<itemize>
7299 <item>Text colors are system dependent. The function may have no effect
7300 on systems where the text color cannot be changed.
7301 <item>The function is only available as fastcall function, so it may only
7302 be used in presence of a prototype.
7304 <tag/Availability/cc65
7306 <ref id="bgcolor" name="bgcolor">,
7307 <ref id="bordercolor" name="bordercolor">
7313 <sect1>time<label id="time"><p>
7317 <tag/Function/Get the time.
7318 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7319 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7320 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7321 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7322 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7323 returned and <tt/errno/ is set to <tt/ENOSYS/.
7324 <tag/Notes/<itemize>
7325 <item>The function is only available as fastcall function, so it may
7326 only be used in presence of a prototype.
7327 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7328 returned value may not be valid.
7330 <tag/Availability/ISO 9899
7332 <ref id="clock" name="clock">
7338 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7342 <tag/Function/Toggle between 40 and 80 column mode.
7343 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7344 <tag/Declaration/<tt/void toggle_videomode (void);/
7345 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7346 old mode (cursor position, color and so on) are saved and restored together
7348 <tag/Notes/<itemize>
7349 <item>The function is specific to the C128.
7350 <item>This function is deprecated. Please use <ref id="videomode"
7351 name="videomode"> instead!
7353 <tag/Availability/C128
7355 <ref id="fast" name="fast">,
7356 <ref id="isfast" name="isfast">,
7357 <ref id="slow" name="slow">,
7358 <ref id="videomode" name="videomode">
7364 <sect1>tolower<label id="tolower"><p>
7368 <tag/Function/Convert a character into its lower case representation.
7369 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7370 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7371 <tag/Description/The function returns the given character converted to lower
7372 case. If the given character is not a letter, it is returned unchanged.
7373 <tag/Notes/<itemize>
7374 <item>The function is only available as fastcall function, so it may
7375 only be used in presence of a prototype.
7377 <tag/Availability/ISO 9899
7379 <ref id="islower" name="islower">,
7380 <ref id="isupper" name="isupper">,
7381 <ref id="toupper" name="toupper">
7387 <sect1>toupper<label id="toupper"><p>
7391 <tag/Function/Convert a character into its upper case representation.
7392 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7393 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7394 <tag/Description/The function returns the given character converted to upper
7395 case. If the given character is not a letter, it is returned unchanged.
7396 <tag/Notes/<itemize>
7397 <item>The function is only available as fastcall function, so it may
7398 only be used in presence of a prototype.
7400 <tag/Availability/ISO 9899
7402 <ref id="islower" name="islower">,
7403 <ref id="isupper" name="isupper">,
7404 <ref id="tolower" name="tolower">
7410 <sect1>ultoa<label id="ultoa"><p>
7414 <tag/Function/Convert an unsigned long integer into a string.
7415 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7416 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7417 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7418 string using <tt/radix/ as the base.
7419 <tag/Notes/<itemize>
7420 <item>There are no provisions to prevent a buffer overflow.
7421 <item>The function is non standard, so it is not available in strict ANSI mode.
7422 You should probably use <tt/sprintf/ instead.
7423 <item>The function is only available as fastcall function, so it may only be
7424 used in presence of a prototype.
7426 <tag/Availability/cc65
7428 <ref id="atoi" name="atoi">,
7429 <ref id="atol" name="atol">,
7430 <ref id="itoa" name="itoa">,
7431 <ref id="ltoa" name="ltoa">,
7432 <ref id="utoa" name="utoa">
7438 <sect1>unlink<label id="unlink"><p>
7442 <tag/Function/Delete a file.
7443 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7444 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7445 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7446 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7447 code describing the reason for the failure.
7448 <tag/Notes/<itemize>
7449 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7450 name="remove">/ instead, which is a native ANSI C function and does the same.
7451 <item>This function is not available on all cc65 targets (depends on the
7452 availability of file I/O).
7453 <item>The function is only available as fastcall function, so it may only
7454 be used in presence of a prototype.
7455 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7456 used, which has the same semantics, but is more portable, because it conforms
7457 to the ISO C standard.
7459 <tag/Availability/POSIX 1003.1
7461 <ref id="remove" name="remove">
7464 #include <stdio.h>
7465 #include <unistd.h>
7467 #define FILENAME "helloworld"
7469 if (unlink (FILENAME) == 0) {
7470 printf ("We deleted %s successfully\n", FILENAME);
7472 printf ("There was a problem deleting %s\n", FILENAME);
7479 <sect1>utoa<label id="utoa"><p>
7483 <tag/Function/Convert an unsigned integer into a string.
7484 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7485 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7486 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7487 using <tt/radix/ as the base.
7488 <tag/Notes/<itemize>
7489 <item>There are no provisions to prevent a buffer overflow.
7490 <item>The function is non standard, so it is not available in strict ANSI mode.
7491 You should probably use <tt/sprintf/ instead.
7492 <item>The function is only available as fastcall function, so it may only be
7493 used in presence of a prototype.
7495 <tag/Availability/cc65
7497 <ref id="atoi" name="atoi">,
7498 <ref id="atol" name="atol">,
7499 <ref id="itoa" name="itoa">,
7500 <ref id="ltoa" name="ltoa">,
7501 <ref id="ultoa" name="ultoa">
7507 <sect1>vcprintf<label id="vcprintf"><p>
7511 <tag/Function/Formatted output to the console.
7512 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7513 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7514 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7515 text where necessary and formatted according to the format string given. The
7516 resulting string is output to the console. <tt/vcprintf/ supports the same
7517 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7518 <tag/Notes/<itemize>
7519 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7520 between <tt/\r/ and <tt/\n/.
7521 <item>The function is only available as fastcall function, so it may only be
7522 used in presence of a prototype.
7524 <tag/Availability/cc65
7526 <ref id="cprintf" name="cprintf">,
7527 <ref id="cputc" name="cputc">,
7528 <ref id="cputcxy" name="cputcxy">,
7529 <ref id="cputs" name="cputs">,
7530 <ref id="cputsxy" name="cputsxy">
7536 <sect1>videomode<label id="videomode"><p>
7540 <tag/Function/Switch to either 40 or 80 column mode.
7541 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7542 <ref id="c128.h" name="c128.h">/
7543 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7544 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7545 the requested mode is already active, nothing happens. The old mode is returned
7547 <tag/Notes/<itemize>
7548 <item>The function is specific to the C128 and enhanced Apple //e.
7549 <item>This function replaces <ref id="toggle_videomode"
7550 name="toggle_videomode">.
7551 <item>The function is only available as fastcall function, so it may only be
7552 used in presence of a prototype.
7554 <tag/Availability/C128 and enhanced Apple //e
7556 <ref id="fast" name="fast">,
7557 <ref id="isfast" name="isfast">,
7558 <ref id="slow" name="slow">,
7559 <ref id="toggle_videomode" name="toggle_videomode">
7565 <sect1>waitvsync<label id="waitvsync"><p>
7569 <tag/Function/Wait until the start of the next frame.
7571 <tt/<ref id="cbm.h" name="cbm.h">/,
7572 <tt/<ref id="gamate.h" name="gamate.h">/,
7573 <tt/<ref id="nes.h" name="nes.h">/,
7574 <tt/<ref id="pce.h" name="pce.h">/
7575 <tag/Declaration/<tt/void waitvsync (void);/
7576 <tag/Description/Wait for vertical sync to reduce flickering.
7577 <tag/Availability/Platforms above
7583 <sect1>wherex<label id="wherex"><p>
7587 <tag/Function/Return the current X position of the text mode cursor.
7588 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7589 <tag/Declaration/<tt/unsigned char wherex (void);/
7590 <tag/Description/The function returns the current X position of the text mode
7591 cursor. Zero is returned for the leftmost screen position.
7592 <tag/Availability/cc65
7594 <ref id="gotox" name="gotox">,
7595 <ref id="gotoy" name="gotoy">,
7596 <ref id="gotoxy" name="gotoxy">,
7597 <ref id="wherey" name="wherey">
7603 <sect1>wherey<label id="wherey"><p>
7607 <tag/Function/Return the current Y position of the text mode cursor.
7608 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7609 <tag/Declaration/<tt/unsigned char wherey (void);/
7610 <tag/Description/The function returns the current Y position of the text mode
7611 cursor. Zero is returned for the uppermost screen position.
7612 <tag/Availability/cc65
7614 <ref id="gotox" name="gotox">,
7615 <ref id="gotoy" name="gotoy">,
7616 <ref id="gotoxy" name="gotoxy">,
7617 <ref id="wherex" name="wherex">