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/apple2.h/<label id="apple2.h"><p>
72 <item><ref id="get_ostype" name="get_ostype">
77 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
81 <item><ref id="get_ostype" name="get_ostype">
85 <item><ref id="videomode" name="videomode">
89 <sect1><tt/assert.h/<label id="assert.h"><p>
92 <item><ref id="assert" name="assert">
96 <sect1><tt/atari.h/<label id="atari.h"><p>
99 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
100 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
101 <!-- <item><ref id="_graphics" name="_graphics"> -->
102 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
103 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
104 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
105 <!-- <item><ref id="_scroll" name="_scroll"> -->
106 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
107 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
108 <item><ref id="get_ostype" name="get_ostype">
109 <!-- <item><ref id="get_tv" name="get_tv"> -->
115 <sect1><tt/atmos.h/<label id="atmos.h"><p>
118 <item><ref id="atmos_explode" name="atmos_explode">
119 <item><ref id="atmos_load" name="atmos_load">
120 <item><ref id="atmos_ping" name="atmos_ping">
121 <item><ref id="atmos_save" name="atmos_save">
122 <item><ref id="atmos_shoot" name="atmos_shoot">
123 <item><ref id="atmos_tick" name="atmos_tick">
124 <item><ref id="atmos_tock" name="atmos_tock">
125 <item><ref id="atmos_zap" name="atmos_zap">
129 <sect1><tt/c128.h/<label id="c128.h"><p>
132 <item><ref id="c64mode" name="c64mode">
133 <item><ref id="fast" name="fast">
134 <item><ref id="slow" name="slow">
135 <item><ref id="toggle_videomode" name="toggle_videomode">
136 <item><ref id="videomode" name="videomode">
140 <sect1><tt/c16.h/<label id="c16.h"><p>
145 <sect1><tt/c64.h/<label id="c64.h"><p>
148 <item><ref id="get_ostype" name="get_ostype">
152 <sect1><tt/cbm.h/<label id="cbm.h"><p>
155 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
156 <item><ref id="cbm_k_basin" name="cbm_k_basin">
157 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
158 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
159 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
160 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
161 <item><ref id="cbm_k_clall" name="cbm_k_clall">
162 <item><ref id="cbm_k_close" name="cbm_k_close">
163 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
164 <item><ref id="cbm_k_getin" name="cbm_k_getin">
165 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
166 <item><ref id="cbm_k_listen" name="cbm_k_listen">
167 <item><ref id="cbm_k_load" name="cbm_k_load">
168 <item><ref id="cbm_k_open" name="cbm_k_open">
169 <item><ref id="cbm_k_readst" name="cbm_k_readst">
170 <item><ref id="cbm_k_save" name="cbm_k_save">
171 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
172 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
173 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
174 <item><ref id="cbm_k_talk" name="cbm_k_talk">
175 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
176 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
177 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
178 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
179 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
180 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
181 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
182 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
183 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
184 <!-- <item><ref id="get_tv" name="get_tv"> -->
185 <item><ref id="waitvsync" name="waitvsync">
186 <item><ref id="kbrepeat" name="kbrepeat">
192 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
195 <item><ref id="peekbsys" name="peekbsys">
196 <item><ref id="peekwsys" name="peekwsys">
197 <item><ref id="pokebsys" name="pokebsys">
198 <item><ref id="pokewsys" name="pokewsys">
202 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
205 <item><ref id="peekbsys" name="peekbsys">
206 <item><ref id="peekwsys" name="peekwsys">
207 <item><ref id="pokebsys" name="pokebsys">
208 <item><ref id="pokewsys" name="pokewsys">
212 <sect1><tt/cc65.h/<label id="cc65.h"><p>
215 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
216 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
217 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
218 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
219 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
220 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
221 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
222 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
223 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
224 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
230 <sect1><tt/conio.h/<label id="conio.h"><p>
233 <item><ref id="bgcolor" name="bgcolor">
234 <item><ref id="bordercolor" name="bordercolor">
235 <item><ref id="cclear" name="cclear">
236 <item><ref id="cclearxy" name="cclearxy">
237 <item><ref id="cgetc" name="cgetc">
238 <item><ref id="chline" name="chline">
239 <item><ref id="chlinexy" name="chlinexy">
240 <item><ref id="clrscr" name="clrscr">
241 <item><ref id="cpeekc" name="cpeekc">
242 <item><ref id="cpeekcolor" name="cpeekcolor">
243 <item><ref id="cpeekrevers" name="cpeekrevers">
244 <item><ref id="cpeeks" name="cpeeks">
245 <item><ref id="cprintf" name="cprintf">
246 <item><ref id="cputc" name="cputc">
247 <item><ref id="cputcxy" name="cputcxy">
248 <item><ref id="cputs" name="cputs">
249 <item><ref id="cputsxy" name="cputsxy">
250 <item><ref id="cursor" name="cursor">
251 <item><ref id="cvline" name="cvline">
252 <item><ref id="cvlinexy" name="cvlinexy">
253 <item><ref id="gotox" name="gotox">
254 <item><ref id="gotoxy" name="gotoxy">
255 <item><ref id="gotoy" name="gotoy">
256 <item><ref id="kbhit" name="kbhit">
257 <item><ref id="revers" name="revers">
258 <item><ref id="screensize" name="screensize">
259 <item><ref id="textcolor" name="textcolor">
260 <item><ref id="vcprintf" name="vcprintf">
261 <item><ref id="wherex" name="wherex">
262 <item><ref id="wherey" name="wherey">
266 <sect1><tt/ctype.h/<label id="ctype.h"><p>
269 <item><ref id="isalnum" name="isalnum">
270 <item><ref id="isalpha" name="isalpha">
271 <item><ref id="isascii" name="isascii">
272 <item><ref id="isblank" name="isblank">
273 <item><ref id="iscntrl" name="iscntrl">
274 <item><ref id="isdigit" name="isdigit">
275 <item><ref id="isgraph" name="isgraph">
276 <item><ref id="islower" name="islower">
277 <item><ref id="isprint" name="isprint">
278 <item><ref id="ispunct" name="ispunct">
279 <item><ref id="isspace" name="isspace">
280 <item><ref id="isupper" name="isupper">
281 <item><ref id="isxdigit" name="isxdigit">
282 <item><ref id="tolower" name="tolower">
283 <item><ref id="toupper" name="toupper">
287 <sect1><tt/dbg.h/<label id="dbg.h"><p>
290 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
296 <sect1><tt/dio.h/<label id="dio.h"><p>
298 <url url="dio.html" name="Low-level disk I/O API">.
301 <sect1><tt/dirent.h/<label id="dirent.h"><p>
304 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
305 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
306 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
307 <item><ref id="_DE_ISREG" name="_DE_ISREG">
308 <item><ref id="closedir" name="closedir">
309 <item><ref id="opendir" name="opendir">
310 <item><ref id="readdir" name="readdir">
311 <item><ref id="rewinddir" name="rewinddir">
312 <item><ref id="seekdir" name="seekdir">
313 <item><ref id="telldir" name="telldir">
319 <sect1><tt/em.h/<label id="em.h"><p>
322 <item><ref id="em_commit" name="em_commit">
323 <item><ref id="em_copyfrom" name="em_copyfrom">
324 <item><ref id="em_copyto" name="em_copyto">
325 <item><ref id="em_install" name="em_install">
326 <item><ref id="em_load_driver" name="em_load_driver">
327 <item><ref id="em_map" name="em_map">
328 <item><ref id="em_pagecount" name="em_pagecount">
329 <item><ref id="em_uninstall" name="em_uninstall">
330 <item><ref id="em_unload" name="em_unload">
331 <item><ref id="em_use" name="em_use">
335 <sect1><tt/errno.h/<label id="errno.h"><p>
338 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
339 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
340 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
341 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
347 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
350 <item><ref id="close" name="close">
351 <item><ref id="creat" name="creat">
352 <item><ref id="open" name="open">
356 <sect1><tt/gamate.h/<label id="gamate.h"><p>
359 <!-- <item><ref id="get_tv" name="get_tv"> -->
360 <item><ref id="waitvsync" name="waitvsync">
366 <sect1><tt/geos.h/<label id="geos.h"><p>
368 <url url="geos.html" name="GEOS API">.
371 <sect1><tt/joystick.h/<label id="joystick.h"><p>
374 <item><ref id="joy_count" name="joy_count">
375 <item><ref id="joy_install" name="joy_install">
376 <item><ref id="joy_load_driver" name="joy_load_driver">
377 <item><ref id="joy_read" name="joy_read">
378 <item><ref id="joy_uninstall" name="joy_uninstall">
379 <item><ref id="joy_unload" name="joy_unload">
383 <sect1><tt/locale.h/<label id="locale.h"><p>
386 <item><ref id="localeconv" name="localeconv">
387 <item><ref id="setlocale" name="setlocale">
391 <sect1><tt/lynx.h/<label id="lynx.h"><p>
394 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
395 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
396 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
397 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
398 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
399 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
400 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
406 <sect1><tt/lz4.h/<label id="lz4.h"><p>
409 <item><ref id="decompress_lz4" name="decompress_lz4">
413 <sect1><tt/modload.h/<label id="modload.h"><p>
416 <item><ref id="mod_load" name="mod_load">
417 <item><ref id="mod_free" name="mod_free">
421 <sect1><tt/mouse.h/<label id="mouse.h"><p>
424 <item><ref id="mouse_buttons" name="mouse_buttons">
425 <item><ref id="mouse_getbox" name="mouse_getbox">
426 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
427 <item><ref id="mouse_hide" name="mouse_hide">
428 <item><ref id="mouse_info" name="mouse_info">
429 <item><ref id="mouse_install" name="mouse_install">
430 <item><ref id="mouse_ioctl" name="mouse_ioctl">
431 <item><ref id="mouse_load_driver" name="mouse_load_driver">
432 <item><ref id="mouse_move" name="mouse_move">
433 <item><ref id="mouse_pos" name="mouse_pos">
434 <item><ref id="mouse_setbox" name="mouse_setbox">
435 <item><ref id="mouse_show" name="mouse_show">
436 <item><ref id="mouse_uninstall" name="mouse_uninstall">
437 <item><ref id="mouse_unload" name="mouse_unload">
441 <sect1><tt/nes.h/<label id="nes.h"><p>
444 <!-- <item><ref id="get_tv" name="get_tv"> -->
445 <item><ref id="waitvsync" name="waitvsync">
451 <sect1><tt/o65.h/<label id="o65.h"><p>
453 The <tt/o65.h/ header file contains structure and constant definitions that
454 may be used when dealing with files in <url
455 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
456 It does not declare any functions.
459 <sect1><tt/pce.h/<label id="pce.h"><p>
462 <!-- <item><ref id="get_tv" name="get_tv"> -->
463 <item><ref id="waitvsync" name="waitvsync">
469 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
472 <item><ref id="PEEK" name="PEEK">
473 <item><ref id="PEEKW" name="PEEKW">
474 <item><ref id="POKE" name="POKE">
475 <item><ref id="POKEW" name="POKEW">
479 <sect1><tt/pen.h/<label id="pen.h"><p>
482 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
483 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
489 <sect1><tt/pet.h/<label id="pet.h"><p>
494 <sect1><tt/plus4.h/<label id="plus4.h"><p>
499 <sect1><tt/serial.h/<label id="serial.h"><p>
501 The <tt/serial.h/ header file contains definitions for initializing serial
505 <item><ref id="ser_close" name="ser_close">
506 <item><ref id="ser_get" name="ser_get">
507 <item><ref id="ser_install" name="ser_install">
508 <item><ref id="ser_ioctl" name="ser_ioctl">
509 <item><ref id="ser_load_driver" name="ser_load_driver">
510 <item><ref id="ser_open" name="ser_open">
511 <item><ref id="ser_put" name="ser_put">
512 <item><ref id="ser_status" name="ser_status">
513 <item><ref id="ser_uninstall" name="ser_uninstall">
514 <item><ref id="ser_unload" name="ser_unload">
518 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
521 <item><ref id="setjmp" name="setjmp">
522 <item><ref id="longjmp" name="longjmp">
526 <sect1><tt/signal.h/<label id="signal.h"><p>
529 <item><ref id="raise" name="raise">
530 <item><ref id="signal" name="signal">
534 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
539 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
544 <sect1><tt/stddef.h/<label id="stddef.h"><p>
547 <item><ref id="offsetof" name="offsetof">
551 <sect1><tt/stdio.h/<label id="stdio.h"><p>
554 <item><ref id="_poserror" name="_poserror">
555 <item><ref id="clearerr" name="clearerr">
556 <!-- <item><ref id="fclose" name="fclose"> -->
557 <!-- <item><ref id="fdopen" name="fdopen"> -->
558 <item><ref id="feof" name="feof">
559 <item><ref id="ferror" name="ferror">
560 <!-- <item><ref id="fflush" name="fflush"> -->
561 <!-- <item><ref id="fgetc" name="fgetc"> -->
562 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
563 <!-- <item><ref id="fgets" name="fgets"> -->
564 <item><ref id="fileno" name="fileno">
565 <!-- <item><ref id="fopen" name="fopen"> -->
566 <!-- <item><ref id="fprintf" name="fprintf"> -->
567 <!-- <item><ref id="fputc" name="fputc"> -->
568 <!-- <item><ref id="fputs" name="fputs"> -->
569 <!-- <item><ref id="fread" name="fread"> -->
570 <!-- <item><ref id="freopen" name="freopen"> -->
571 <!-- <item><ref id="fscanf" name="fscanf"> -->
572 <!-- <item><ref id="fseek" name="fseek"> -->
573 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
574 <!-- <item><ref id="ftell" name="ftell"> -->
575 <!-- <item><ref id="fwrite" name="fwrite"> -->
576 <!-- <item><ref id="getc" name="getc"> -->
577 <!-- <item><ref id="getchar" name="getchar"> -->
578 <!-- <item><ref id="gets" name="gets"> -->
579 <!-- <item><ref id="printf" name="printf"> -->
580 <!-- <item><ref id="putc" name="putc"> -->
581 <!-- <item><ref id="putchar" name="putchar"> -->
582 <!-- <item><ref id="puts" name="puts"> -->
583 <item><ref id="rename" name="rename">
584 <item><ref id="remove" name="remove">
585 <!-- <item><ref id="rewind" name="rewind"> -->
586 <!-- <item><ref id="scanf" name="scanf"> -->
587 <!-- <item><ref id="snprintf" name="snprintf"> -->
588 <!-- <item><ref id="sprintf" name="sprintf"> -->
589 <!-- <item><ref id="sscanf" name="sscanf"> -->
590 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
591 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
592 <!-- <item><ref id="vprintf" name="vprintf"> -->
593 <!-- <item><ref id="vscanf" name="vscanf"> -->
594 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
595 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
596 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
602 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
605 <item><ref id="_heapadd" name="_heapadd">
606 <item><ref id="_heapblocksize" name="_heapblocksize">
607 <item><ref id="_heapmaxavail" name="_heapmaxavail">
608 <item><ref id="_heapmemavail" name="_heapmemavail">
609 <item><ref id="_randomize" name="_randomize">
610 <item><ref id="_swap" name="_swap">
611 <item><ref id="abort" name="abort">
612 <item><ref id="abs" name="abs">
613 <item><ref id="atexit" name="atexit">
614 <item><ref id="atoi" name="atoi">
615 <item><ref id="atol" name="atol">
616 <item><ref id="bsearch" name="bsearch">
617 <item><ref id="calloc" name="calloc">
618 <item><ref id="div" name="div">
619 <item><ref id="exit" name="exit">
620 <item><ref id="free" name="free">
621 <item><ref id="getenv" name="getenv">
622 <item><ref id="itoa" name="itoa">
623 <item><ref id="labs" name="labs">
624 <item><ref id="ltoa" name="ltoa">
625 <item><ref id="malloc" name="malloc">
626 <item><ref id="perror" name="perror">
627 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
628 <!-- <item><ref id="putenv" name="putenv"> -->
629 <item><ref id="qsort" name="qsort">
630 <item><ref id="rand" name="rand">
631 <item><ref id="realloc" name="realloc">
632 <item><ref id="srand" name="srand">
633 <!-- <item><ref id="system" name="system"> -->
634 <item><ref id="ultoa" name="ultoa">
635 <item><ref id="utoa" name="utoa">
641 <sect1><tt/string.h/<label id="string.h"><p>
644 <item><ref id="_stroserror" name="_stroserror">
645 <item><ref id="bzero" name="bzero">
646 <item><ref id="memchr" name="memchr">
647 <item><ref id="memcmp" name="memcmp">
648 <item><ref id="memcpy" name="memcpy">
649 <item><ref id="memmove" name="memmove">
650 <item><ref id="memset" name="memset">
651 <item><ref id="strcasecmp" name="strcasecmp">
652 <item><ref id="strcat" name="strcat">
653 <item><ref id="strchr" name="strchr">
654 <item><ref id="strcmp" name="strcmp">
655 <item><ref id="strcoll" name="strcoll">
656 <item><ref id="strcpy" name="strcpy">
657 <item><ref id="strcspn" name="strcspn">
658 <item><ref id="strdup" name="strdup">
659 <item><ref id="strerror" name="strerror">
660 <item><ref id="stricmp" name="stricmp">
661 <item><ref id="strlen" name="strlen">
662 <item><ref id="strlower" name="strlower">
663 <item><ref id="strlwr" name="strlwr">
664 <item><ref id="strncat" name="strncat">
665 <item><ref id="strncmp" name="strncmp">
666 <item><ref id="strncpy" name="strncpy">
667 <item><ref id="strqtok" name="strqtok">
668 <item><ref id="strrchr" name="strrchr">
669 <item><ref id="strspn" name="strspn">
670 <item><ref id="strstr" name="strstr">
671 <item><ref id="strtok" name="strtok">
672 <item><ref id="strxfrm" name="strxfrm">
673 <item><ref id="strupper" name="strupper">
674 <item><ref id="strupr" name="strupr">
680 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
683 <item><ref id="atmos_explode" name="explode">
684 <item><ref id="atmos_ping" name="ping">
685 <item><ref id="atmos_shoot" name="shoot">
686 <item><ref id="atmos_zap" name="zap">
687 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
688 <!-- <item><ref id="oups" name="oups"> -->
694 <sect1><tt/tgi.h/<label id="tgi.h"><p>
696 <url url="tgi.html" name="Tiny Graphics Interface">.
699 <sect1><tt/time.h/<label id="time.h"><p>
702 <!-- <item><ref id="_systime" name="_systime"> -->
703 <!-- <item><ref id="asctime" name="asctime"> -->
704 <item><ref id="clock" name="clock">
705 <!-- <item><ref id="ctime" name="ctime"> -->
706 <!-- <item><ref id="gmtime" name="gmtime"> -->
707 <!-- <item><ref id="localtime" name="localtime"> -->
708 <!-- <item><ref id="mktime" name="mktime"> -->
709 <!-- <item><ref id="strftime" name="strftime"> -->
710 <item><ref id="time" name="time">
716 <sect1><tt/unistd.h/<label id="unistd.h"><p>
719 <!-- <item><ref id="chdir" name="chdir"> -->
720 <item><ref id="exec" name="exec">
721 <!-- <item><ref id="getcwd" name="getcwd"> -->
722 <item><ref id="getopt" name="getopt">
723 <!-- <item><ref id="lseek" name="lseek"> -->
724 <!-- <item><ref id="mkdir" name="mkdir"> -->
725 <!-- <item><ref id="read" name="read"> -->
726 <!-- <item><ref id="rmdir" name="rmdir"> -->
727 <item><ref id="sleep" name="sleep">
728 <item><ref id="unlink" name="unlink">
729 <!-- <item><ref id="write" name="write"> -->
735 <sect1><tt/vic20.h/<label id="vic20.h"><p>
740 <sect1><tt/zlib.h/<label id="zlib.h"><p>
743 <!-- <item><ref id="adler32" name="adler32"> -->
744 <!-- <item><ref id="crc32" name="crc32"> -->
745 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
746 <!-- <item><ref id="uncompress" name="uncompress"> -->
752 <sect>Alphabetical function reference<p>
754 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
758 <tag/Function/Determine if a directory entry specifies a directory.
759 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
760 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
761 <tag/Description/The function is called with the type of a directory entry
762 taken from a <tt/struct dirent/ and returns true if the entry designates
765 <item>The function is actually a macro.
767 <tag/Availability/cc65
769 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
770 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
771 <ref id="_DE_ISREG" name="_DE_ISREG">
777 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
781 <tag/Function/Determine if a directory entry specifies a disk label.
782 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
783 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
784 <tag/Description/The function is called with the type of a directory entry
785 taken from a <tt/struct dirent/ and returns true if the entry designates
788 <item>The function is actually a macro.
790 <tag/Availability/cc65
792 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
793 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
794 <ref id="_DE_ISREG" name="_DE_ISREG">
800 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
804 <tag/Function/Determine if a directory entry specifies a link.
805 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
806 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
807 <tag/Description/The function is called with the type of a directory entry
808 taken from a <tt/struct dirent/ and returns true if the entry designates
811 <item>The function is actually a macro.
813 <tag/Availability/cc65
815 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
816 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
817 <ref id="_DE_ISREG" name="_DE_ISREG">
823 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
827 <tag/Function/Determine if a directory entry specifies a regular file.
828 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
829 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
830 <tag/Description/The function is called with the type of a directory entry
831 taken from a <tt/struct dirent/ and returns true if the entry designates
834 <item>The function is actually a macro.
835 <item>A "regular file" means anything with data in it. This might still mean
836 that special processing is needed, when accessing the file. Relative files of
837 the CBM systems are classified as being "regular" files, for example.
839 <tag/Availability/cc65
841 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
842 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
843 <ref id="_DE_ISLNK" name="_DE_ISLNK">
849 <sect1>_heapadd<label id="_heapadd"><p>
853 <tag/Function/Add a block to the heap.
854 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
855 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
856 <tag/Description/The function adds a block of raw memory to the heap.
858 <item>The minimum blocksize that can be added is 6 bytes; the function will
859 ignore smaller blocks.
860 <item>The function is available only as a fastcall function; so, it may be used
861 only in the presence of a prototype.
863 <tag/Availability/cc65
865 <ref id="_heapblocksize" name="_heapblocksize">,
866 <ref id="_heapmaxavail" name="_heapmaxavail">,
867 <ref id="_heapmemavail" name="_heapmemavail">,
868 <ref id="calloc" name="calloc">,
869 <ref id="free" name="free">,
870 <ref id="malloc" name="malloc">,
871 <ref id="realloc" name="realloc">
877 <sect1>_heapblocksize<label id="_heapblocksize"><p>
881 <tag/Function/Return the size of an allocated block.
882 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
883 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
884 <tag/Description/The function returns the size of a block that must have
885 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
886 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
888 <item>Passing a pointer to a block that was is not the result of one of the
889 allocation functions, or that has been free'd will give unpredicable results.
890 <item>The function is available only as a fastcall function; so, it may be used
891 only in the presence of a prototype.
893 <tag/Availability/cc65
895 <ref id="_heapadd" name="_heapadd">,
896 <ref id="_heapmaxavail" name="_heapmaxavail">,
897 <ref id="_heapmemavail" name="_heapmemavail">,
898 <ref id="calloc" name="calloc">,
899 <ref id="free" name="free">,
900 <ref id="malloc" name="malloc">,
901 <ref id="realloc" name="realloc">
907 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
911 <tag/Function/Return the largest block that is available on the heap.
912 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
913 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
914 <tag/Description/The function returns the size of the largest block that may
915 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
916 <tag/Availability/cc65
918 <ref id="_heapadd" name="_heapadd">,
919 <ref id="_heapblocksize" name="_heapblocksize">,
920 <ref id="_heapmemavail" name="_heapmemavail">,
921 <ref id="calloc" name="calloc">,
922 <ref id="free" name="free">,
923 <ref id="malloc" name="malloc">,
924 <ref id="realloc" name="realloc">
930 <sect1>_heapmemavail<label id="_heapmemavail"><p>
934 <tag/Function/Return the total available space on the heap.
935 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
936 <tag/Declaration/<tt/size_t _heapmemavail (void);/
937 <tag/Description/The function returns the total number of bytes available on
940 <item>This function is of less use than usually assumed, since the returned
941 heap space may be available but not in one block. So even if this function
942 says that several times more heap space is available than needed, <ref
943 id="malloc" name="malloc"> may still return <tt/NULL/.
945 <tag/Availability/cc65
947 <ref id="_heapadd" name="_heapadd">,
948 <ref id="_heapblocksize" name="_heapblocksize">,
949 <ref id="_heapmaxavail" name="_heapmaxavail">,
950 <ref id="calloc" name="calloc">,
951 <ref id="free" name="free">,
952 <ref id="malloc" name="malloc">,
953 <ref id="realloc" name="realloc">
959 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
963 <tag/Function/Determines whether the underlying DOS supports command line arguments.
964 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
965 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
966 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
967 It returns 1 if it does.
968 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
973 <sect1>_poserror<label id="_poserror"><p>
977 <tag/Function/Print an error message for the error in <tt/_oserror/.
978 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
979 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
980 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
981 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
982 a colon and a blank. Then the error message for the current contents of
983 <tt/_oserror/ are printed followed by a newline. The message output is the
984 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
985 argument of <tt/_oserror/.
987 <item>Since operating system specific error code are - you guessed it -
988 operating system specific, the value in <tt/_oserror/ and the message that is
989 printed depends on the cc65 target.
990 <item>The function is only available as fastcall function, so it may only
991 be used in presence of a prototype.
993 <tag/Availability/cc65
995 <ref id="_stroserror" name="_stroserror">,
996 <ref id="perror" name="perror">
1002 <sect1>_randomize<label id="_randomize"><p>
1006 <tag/Function/Initialize the pseudo random number generator.
1007 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1008 <tag/Declaration/<tt/void _randomize (void);/
1009 <tag/Description/The function initializes the random number generator with
1010 a seed derived from fast changing hardware events, so the seed itself can be
1011 considered random to a certain degree.
1012 <tag/Notes/<itemize>
1013 <item>The randomness of the seed depends on the machine hardware.
1015 <tag/Availability/cc65
1017 <ref id="rand" name="rand">,
1018 <ref id="srand" name="srand">
1024 <sect1>_stroserror<label id="_stroserror"><p>
1028 <tag/Function/Return a string describing an OS specific error code.
1029 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1030 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1031 <tag/Description/<tt/_stroserror/ will return a string describing the given
1032 operating system specific error code.
1033 <tag/Notes/<itemize>
1034 <item>Since operating system specific error code are - you guessed it -
1035 operating system specific, the parameter and the string returned depend on the
1037 <item>The function is only available as fastcall function, so it may only be
1038 used in presence of a prototype.
1040 <tag/Availability/cc65
1042 <ref id="strerror" name="strerror">
1048 <sect1>_swap<label id="_swap"><p>
1052 <tag/Function/Swap the contents of memory areas.
1053 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1054 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1055 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1056 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1057 <tt/size/ bytes in size.
1058 <tag/Notes/<itemize>
1059 <item>The memory areas may not overlap, otherwise the results are undefined.
1060 <item>The function is only available as fastcall function, so it may only be
1061 used in presence of a prototype.
1063 <tag/Availability/cc65
1065 <ref id="memcpy" name="memcpy">,
1066 <ref id="memmove" name="memmove">
1072 <sect1>_sys<label id="_sys"><p>
1076 <tag/Function/Call a subroutine passing register values.
1077 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1078 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1079 <tag/Description/The function will call the subroutine at the address
1080 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1081 registers and the CPU flags are set to the values given in the <tt/regs/
1082 structure. On return from the subroutine, the new values of the registers and
1083 flags are stored back overwriting the old values.
1084 <tag/Notes/<itemize>
1085 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1086 when calling the subroutine (they are unchanged from their current values).
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
1096 <sect1>BRK<label id="BRK"><p>
1100 <tag/Function/Insert a 6502 BRK instrunction into the code.
1101 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1102 <tag/Declaration/<tt/void BRK (void);/
1103 <tag/Description/The function will insert a 6502 BRK instruction into the code
1104 which may be used to trigger a debugger.
1105 <tag/Notes/<itemize>
1106 <item>The function is actually a macro.
1107 <item>The inserted instruction may lead to unexpected results if no debugger
1110 <tag/Availability/cc65
1112 <ref id="CLI" name="CLI">,
1113 <ref id="SEI" name="SEI">
1119 <sect1>CLI<label id="CLI"><p>
1123 <tag/Function/Insert a 6502 CLI instrunction into the code.
1124 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1125 <tag/Declaration/<tt/void CLI (void);/
1126 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1127 so interrupts are enabled. Enabling interrupts has no effects if they are
1128 already enabled (the default).
1129 <tag/Notes/<itemize>
1130 <item>The function is actually a macro.
1131 <item>Disabling interrupts may lead to unexpected results.
1133 <tag/Availability/cc65
1135 <ref id="BRK" name="BRK">,
1136 <ref id="SEI" name="SEI">
1142 <sect1>PEEK<label id="PEEK"><p>
1146 <tag/Function/Read a byte from memory.
1147 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1148 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1149 <tag/Description/The function will read the absolute memory given by <tt/addr/
1150 and return the value read.
1151 <tag/Notes/<itemize>
1152 <item>The function is actually a macro.
1153 <item>This function depends highly on the platform and environment.
1155 <tag/Availability/cc65
1157 <ref id="PEEKW" name="PEEKW">,
1158 <ref id="POKE" name="POKE">
1164 <sect1>PEEKW<label id="PEEKW"><p>
1168 <tag/Function/Read a word (two bytes) from memory.
1169 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1170 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1171 <tag/Description/The function will read the absolute memory given by <tt/addr/
1172 and return the value read. The byte read from the higher address is the high
1173 byte of the return value.
1174 <tag/Notes/<itemize>
1175 <item>The function is actually a macro.
1176 <item>This function depends highly on the platform and environment.
1177 <item>The order in which the two bytes are read is unspecified and may
1178 depend of the address expression used.
1180 <tag/Availability/cc65
1182 <ref id="PEEK" name="PEEK">,
1183 <ref id="POKE" name="POKE">
1189 <sect1>POKE<label id="POKE"><p>
1193 <tag/Function/Write a byte to memory.
1194 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1195 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1196 <tag/Description/The function writes the value <tt/val/ to the absolute
1197 memory address given by <tt/addr/.
1198 <tag/Notes/<itemize>
1199 <item>The function is actually a macro.
1200 <item>This function depends highly on the platform and environment.
1201 <item>Careless use will cause the program to act strange or may crash the
1204 <tag/Availability/cc65
1206 <ref id="PEEK" name="PEEK">,
1207 <ref id="POKEW" name="POKEW">
1213 <sect1>POKEW<label id="POKEW"><p>
1217 <tag/Function/Write a word (two bytes) to memory.
1218 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1219 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1220 <tag/Description/The function writes the value <tt/val/ to the absolute
1221 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1222 the <tt/addr/, the high byte is written to <tt/addr+1/.
1223 <tag/Notes/<itemize>
1224 <item>The function is actually a macro.
1225 <item>This function depends highly on the platform and environment.
1226 <item>Careless use will cause the program to act strange or may crash the
1228 <item>The order in which the two bytes are written is unspecified and may
1229 depend of the address expression used.
1231 <tag/Availability/cc65
1233 <ref id="PEEK" name="PEEK">,
1234 <ref id="POKE" name="POKE">
1240 <sect1>SEI<label id="SEI"><p>
1244 <tag/Function/Insert a 6502 SEI instrunction into the code.
1245 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1246 <tag/Declaration/<tt/void SEI (void);/
1247 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1248 so interrupts are disabled. Note that non maskable interrupts cannot be
1250 <tag/Notes/<itemize>
1251 <item>The function is actually a macro.
1252 <item>Disabling interrupts may lead to unexpected results.
1254 <tag/Availability/cc65
1256 <ref id="BRK" name="BRK">,
1257 <ref id="CLI" name="CLI">
1263 <sect1>abort<label id="abort"><p>
1267 <tag/Function/Terminates a program abnormally.
1268 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1269 <tag/Declaration/<tt/void abort (void);/
1270 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1271 on stderr, then terminates the program with an exit code of 3.
1272 <tag/Availability/ISO 9899
1274 <ref id="assert" name="assert">,
1275 <ref id="exit" name="exit">,
1276 <ref id="raise" name="raise">
1282 <sect1>abs<label id="abs"><p>
1286 <tag/Function/Returns the absolute value of an integer.
1287 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1288 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1289 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1291 <tag/Notes/<itemize>
1292 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1293 <item>The function is only available as fastcall function, so it may only be
1294 used in presence of a prototype.
1296 <tag/Availability/ISO 9899
1298 <ref id="labs" name="labs">
1304 <sect1>assert<label id="assert"><p>
1308 <tag/Function/Test a condition and possibly abort.
1309 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1310 <tag/Declaration/<tt/void assert (int cond);/
1311 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1312 statement. If the condition evaluates t zero (false), assert prints a message
1313 on stderr and aborts the program.
1314 <tag/Notes/<itemize>
1315 <item>The function is actually a macro.
1317 <tag/Availability/ISO 9899
1319 <ref id="abort" name="abort">,
1320 <ref id="exit" name="exit">
1326 <sect1>atexit<label id="atexit"><p>
1330 <tag/Function/Register an exit function.
1331 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1332 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1333 <tag/Description/<tt/atexit/ registers the function pointed to by
1334 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1335 terminates, they are called in LIFO order (the last function registered is
1336 called first). <tt/atexit/ returns zero on success and a nonzero value on
1338 <tag/Notes/<itemize>
1339 <item>A maximum of 5 exit functions can be registered.
1340 <item>There is no way to unregister an exit function.
1341 <item>The function is only available as fastcall function, so it may only be
1342 used in presence of a prototype.
1344 <tag/Availability/ISO 9899
1346 <ref id="abort" name="abort">,
1347 <ref id="exit" name="exit">
1353 <sect1>atmos_explode<label id="atmos_explode"><p>
1357 <tag/Function/Bomb sound effect.
1358 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1359 <tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/
1360 <tag/Description/<tt/atmos_explode/ plays the BASIC sound.
1361 <tag/Notes/<itemize>
1362 <item>The function is available only as a fastcall function; so, it may be used
1363 only in the presence of a prototype.
1365 <tag/Availability/cc65
1367 <ref id="atmos_ping" name="atmos_ping">,
1368 <ref id="atmos_shoot" name="atmos_shoot">,
1369 <ref id="atmos_tick" name="atmos_tick">,
1370 <ref id="atmos_tock" name="atmos_tock">,
1371 <ref id="atmos_zap" name="atmos_zap">
1377 <sect1>atmos_load<label id="atmos_load"><p>
1381 <tag/Function/Load Atmos tape.
1382 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1383 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1384 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1385 <tag/Notes/<itemize>
1386 <item>The function is available only as a fastcall function; so, it may be used
1387 only in the presence of a prototype.
1389 <tag/Availability/cc65
1391 <ref id="atmos_save" name="atmos_save">
1397 <sect1>atmos_ping<label id="atmos_ping"><p>
1401 <tag/Function/Bell or ricochet sound effect.
1402 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1403 <tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/
1404 <tag/Description/<tt/atmos_ping/ plays the BASIC sound.
1405 <tag/Notes/<itemize>
1406 <item>The function is available only as a fastcall function; so, it may be used
1407 only in the presence of a prototype.
1409 <tag/Availability/cc65
1411 <ref id="atmos_explode" name="atmos_explode">,
1412 <ref id="atmos_shoot" name="atmos_shoot">,
1413 <ref id="atmos_tick" name="atmos_tick">,
1414 <ref id="atmos_tock" name="atmos_tock">,
1415 <ref id="atmos_zap" name="atmos_zap">
1421 <sect1>atmos_save<label id="atmos_save"><p>
1425 <tag/Function/Save Atmos tape.
1426 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1427 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1428 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1429 <tag/Notes/<itemize>
1430 <item>The function is available only as a fastcall function; so, it may be used
1431 only in the presence of a prototype.
1433 <tag/Availability/cc65
1435 <ref id="atmos_load" name="atmos_load">
1437 atmos_save("hires", 0xa000, 0xc000);
1443 <sect1>atmos_shoot<label id="atmos_shoot"><p>
1447 <tag/Function/Pistol sound effect.
1448 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1449 <tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/
1450 <tag/Description/<tt/atmos_shoot/ plays the BASIC sound.
1451 <tag/Notes/<itemize>
1452 <item>The function is available only as a fastcall function; so, it may be used
1453 only in the presence of a prototype.
1455 <tag/Availability/cc65
1457 <ref id="atmos_explode" name="atmos_explode">,
1458 <ref id="atmos_ping" name="atmos_ping">,
1459 <ref id="atmos_tick" name="atmos_tick">,
1460 <ref id="atmos_tock" name="atmos_tock">,
1461 <ref id="atmos_zap" name="atmos_zap">
1467 <sect1>atmos_tick<label id="atmos_tick"><p>
1471 <tag/Function/High-pitch click.
1472 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1473 <tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/
1474 <tag/Description/<tt/atmos_tick/ plays the system sound.
1475 <tag/Notes/<itemize>
1476 <item>The function is available only as a fastcall function; so, it may be used
1477 only in the presence of a prototype.
1479 <tag/Availability/cc65
1481 <ref id="atmos_explode" name="atmos_explode">,
1482 <ref id="atmos_ping" name="atmos_ping">,
1483 <ref id="atmos_shoot" name="atmos_shoot">,
1484 <ref id="atmos_tock" name="atmos_tock">,
1485 <ref id="atmos_zap" name="atmos_zap">
1491 <sect1>atmos_tock<label id="atmos_tock"><p>
1495 <tag/Function/Low-pitch click.
1496 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1497 <tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/
1498 <tag/Description/<tt/atmos_tock/ plays the system sound.
1499 <tag/Notes/<itemize>
1500 <item>The function is available only as a fastcall function; so, it may be used
1501 only in the presence of a prototype.
1503 <tag/Availability/cc65
1505 <ref id="atmos_explode" name="atmos_explode">,
1506 <ref id="atmos_ping" name="atmos_ping">,
1507 <ref id="atmos_shoot" name="atmos_shoot">,
1508 <ref id="atmos_tick" name="atmos_tick">,
1509 <ref id="atmos_zap" name="atmos_zap">
1515 <sect1>atmos_zap<label id="atmos_zap"><p>
1519 <tag/Function/Raygun sound effect.
1520 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1521 <tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/
1522 <tag/Description/<tt/atmos_zap/ plays the BASIC sound.
1523 <tag/Notes/<itemize>
1524 <item>The function is available only as a fastcall function; so, it may be used
1525 only in the presence of a prototype.
1527 <tag/Availability/cc65
1529 <ref id="atmos_explode" name="atmos_explode">,
1530 <ref id="atmos_ping" name="atmos_ping">,
1531 <ref id="atmos_shoot" name="atmos_shoot">,
1532 <ref id="atmos_tick" name="atmos_tick">,
1533 <ref id="atmos_tock" name="atmos_tock">
1539 <sect1>atoi<label id="atoi"><p>
1543 <tag/Function/Convert a string to an integer.
1544 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1545 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1546 <tag/Description/<tt/atoi/ converts the given string into an integer.
1547 Conversion stops as soon as any invalid character is encountered.
1548 <tag/Notes/<itemize>
1549 <item>There is no way to detect any conversion errors.
1550 <item>The function does not check for an numerical overflow when converting.
1551 <item>The function is only available as fastcall function, so it may only be
1552 used in presence of a prototype.
1554 <tag/Availability/ISO 9899
1556 <ref id="atol" name="atol">,
1557 <ref id="itoa" name="itoa">,
1558 <ref id="ltoa" name="ltoa">,
1559 <ref id="ultoa" name="ultoa">,
1560 <ref id="utoa" name="utoa">
1566 <sect1>atol<label id="atol"><p>
1570 <tag/Function/Convert a string to a long integer.
1571 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1572 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1573 <tag/Description/<tt/atol/ converts the given string into a long integer.
1574 Conversion stops as soon as any invalid character is encountered.
1575 <tag/Notes/<itemize>
1576 <item>There is no way to detect any conversion errors.
1577 <item>The function does not check for an numerical overflow when converting.
1578 <item>The function is only available as fastcall function, so it may only be
1579 used in presence of a prototype.
1581 <tag/Availability/ISO 9899
1583 <ref id="atoi" name="atoi">,
1584 <ref id="itoa" name="itoa">,
1585 <ref id="ltoa" name="ltoa">,
1586 <ref id="ultoa" name="ultoa">,
1587 <ref id="utoa" name="utoa">
1593 <sect1>bgcolor<label id="bgcolor"><p>
1597 <tag/Function/Set the background text color.
1598 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1599 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1600 <tag/Description/The function will set a new background color and return the
1601 old (current) one. The background color is valid for the whole text output
1602 area of the screen, not just for new text.
1603 <tag/Notes/<itemize>
1604 <item>Background colors are system dependent. The function may have no effect
1605 on systems where the background color cannot be changed.
1606 <item>The function is only available as fastcall function, so it may only be
1607 used in presence of a prototype.
1609 <tag/Availability/cc65
1611 <ref id="bordercolor" name="bordercolor">,
1612 <ref id="textcolor" name="textcolor">
1618 <sect1>bordercolor<label id="bordercolor"><p>
1622 <tag/Function/Set the border (frame) color.
1623 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1624 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1625 <tag/Description/The function will set a new border color. It returns the old
1626 (current) border color.
1627 <tag/Notes/<itemize>
1628 <item>Border colors are system dependent. The function may have no effect
1629 on systems where the border color cannot be changed.
1630 <item>The function is only available as fastcall function, so it may only
1631 be used in presence of a prototype.
1633 <tag/Availability/cc65
1635 <ref id="bgcolor" name="bgcolor">,
1636 <ref id="textcolor" name="textcolor">
1642 <sect1>bsearch<label id="bsearch"><p>
1646 <tag/Function/Do a binary search in a sorted array.
1647 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1648 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1649 const void* base, size_t n, size_t size,
1650 int __fastcall__ (* cmp) (const void*, const void*));/
1651 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1652 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1653 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1654 the function used to compare the members against the key. The function returns
1655 a pointer to the member found, or <tt/NULL/ if there was no match.
1656 <tag/Notes/<itemize>
1657 <item>The contents of the array must be sorted in ascending order according to
1658 the compare function given.
1659 <item>If there are multiple members that match the key, the function will
1660 return one of the members.
1661 <item>The function is only available as fastcall function, so it may only
1662 be used in presence of a prototype.
1663 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1666 <tag/Availability/ISO 9899
1668 <ref id="qsort" name="qsort">
1674 <sect1>bzero<label id="bzero"><p>
1678 <tag/Function/Fill a memory area with zeroes.
1679 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1680 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1681 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1683 <tag/Notes/<itemize>
1684 <item>The function is non standard and therefore only available in non ANSI
1685 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1686 <item>The function is only available as fastcall function, so it may only
1687 be used in presence of a prototype.
1689 <tag/Availability/cc65
1691 <ref id="_swap" name="_swap">,
1692 <ref id="memcpy" name="memcpy">,
1693 <ref id="memmove" name="memmove">,
1694 <ref id="memset" name="memset">,
1700 <sect1>c64mode<label id="c64mode"><p>
1704 <tag/Function/Switch the C128 into C64 compatible mode.
1705 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1706 <tag/Declaration/<tt/void c64mode (void);/
1707 <tag/Description/The function will cause the machine to reboot into C64 mode.
1708 <tag/Notes/<itemize>
1709 <item>The function is specific to the C128.
1710 <item>The function will not return to the caller.
1712 <tag/Availability/C128
1718 <sect1>calloc<label id="calloc"><p>
1722 <tag/Function/Allocate and clear memory.
1723 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1724 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1725 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1726 of size <tt/size/, clears the whole block with binary zeroes and returns a
1727 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1729 <tag/Notes/<itemize>
1730 <item>Clearing the memory may not have the expected effect on all platforms:
1731 pointers in the block may not be <tt/NULL/ and floating point variables may
1732 not be zero (0.0). In other words: The "clearing" effect of this function
1733 should be used with care for portable programs.
1734 <item>The function is only available as fastcall function, so it may only
1735 be used in presence of a prototype.
1737 <tag/Availability/ISO 9899
1739 <ref id="_heapadd" name="_heapadd">,
1740 <ref id="_heapblocksize" name="_heapblocksize">,
1741 <ref id="_heapmaxavail" name="_heapmaxavail">,
1742 <ref id="_heapmemavail" name="_heapmemavail">,
1743 <ref id="free" name="free">,
1744 <ref id="malloc" name="malloc">,
1745 <ref id="realloc" name="realloc">
1751 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1755 <tag/Function/Input byte from serial bus
1756 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1757 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1758 <tag/Description/The function returns a byte of data, which it
1759 gets from the current TALKer on the serial bus.
1760 In order to receive the data, the device must have previously been
1761 sent a command to TALK and a secondary address if it needs one.
1762 <tag/Notes/<itemize>
1765 <tag/Availability/cc65
1767 <ref id="cbm_k_talk" name="cbm_k_talk">,
1773 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1777 <tag/Function/Input a Character from the Current Device
1778 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1779 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1780 <tag/Description/The function returns a character from the current input device.
1781 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1782 When this function is called, the next byte of data available from the device is returned.
1783 Exception is the routine for the keyboard device (which is the default input device).
1784 <tag/Notes/<itemize>
1787 <tag/Availability/cc65
1789 <ref id="cbm_k_open" name="cbm_k_open">,
1790 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1796 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1800 <tag/Function/Output a byte
1801 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1802 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1803 <tag/Description/Function sends the character to the current output device.
1804 Unless a device has been OPENed and designated as the
1805 current output channel using the CHKOUT routine, the character is
1806 printed to the screen, which is the default output device. If the
1807 cassette is the current device, outputting a byte will only add it to
1808 the buffer. No actual transmission of data will occur until the
1809 192-byte buffer is full.
1810 <tag/Notes/<itemize>
1811 <item>The function is only available as fastcall function, so it may
1812 only be used in presence of a prototype.
1814 <tag/Availability/cc65
1816 <ref id="cbm_k_open" name="cbm_k_open">,
1817 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1823 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1827 <tag/Function/Designate a Logical File As the Current Input Channel
1828 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1829 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1830 <tag/Description/If you wish to
1831 get data from any device other than the keyboard, this function must be
1832 called after OPENing the device, before you can get a data byte with
1833 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1834 the logical file whose file number was supplied as the
1835 current file, its device as the current device, and its secondary
1836 address as the current secondary address. If the device on the
1837 channel is a serial device, which requires a TALK command and
1838 sometimes a secondary address, function will send them over the
1840 <tag/Notes/<itemize>
1841 <item>The function is only available as fastcall function, so it may
1842 only be used in presence of a prototype.
1844 <tag/Availability/cc65
1846 <ref id="cbm_k_open" name="cbm_k_open">,
1847 <ref id="cbm_k_basin" name="cbm_k_basin">,
1848 <ref id="cbm_k_getin" name="cbm_k_getin">
1854 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1858 <tag/Function/Transmit a byte over the serial bus
1859 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1860 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1861 <tag/Description/Purpose of this function is to send a byte of data over
1862 the serial bus. In order for the data to be received, the serial
1863 device must have first been commanded to LISTEN and been given a
1864 secondary address if necessary. This routine always buffers the
1865 current character, and defers sending it until the next byte is
1866 buffered. When the UNLISTEN command is sent, the last byte will be
1867 sent with an End or Identify (EOI).
1868 <tag/Notes/<itemize>
1869 <item>The function is only available as fastcall function, so it may
1870 only be used in presence of a prototype.
1872 <tag/Availability/cc65
1874 <ref id="cbm_k_listen" name="cbm_k_listen">,
1875 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1881 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1885 <tag/Function/Designate a Logical File As the Current Output Channel
1886 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1887 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1888 <tag/Description/If you wish to
1889 output data to any device other than the screen, this routine must be
1890 called after OPENing the device, and before you output a data byte
1891 with the cbm_k_bsout() function. When called, the function will designate the
1892 logical file whose file number was supplied as the current
1893 file, its device as the current device, and its secondary address as
1894 the current secondary address. If the device on the channel uses the
1895 serial bus, and therefore requires a LISTEN command and possibly a
1896 secondary address, this information will be sent on the bus.
1897 <tag/Notes/<itemize>
1898 <item>The function is only available as fastcall function, so it may
1899 only be used in presence of a prototype.
1901 <tag/Availability/cc65
1903 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1904 <ref id="cbm_k_listen" name="cbm_k_listen">
1910 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1914 <tag/Function/Close All Logical I/O Files
1915 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1916 <tag/Declaration/<tt/void cbm_k_clall (void);/
1917 <tag/Description/It closes all
1918 open files, by resetting the index into open files to
1919 zero and restores the default I/O devices.
1920 <tag/Notes/<itemize>
1923 <tag/Availability/cc65
1925 <ref id="cbm_k_open" name="cbm_k_open">,
1926 <ref id="cbm_k_close" name="cbm_k_close">
1932 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1936 <tag/Function/Close a Logical I/O File
1937 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1938 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1939 <tag/Description/It is used to
1940 close a logical file after all I/O operations involving that file have
1942 <tag/Notes/<itemize>
1943 <item>The function is only available as fastcall function, so it may
1944 only be used in presence of a prototype.
1946 <tag/Availability/cc65
1948 <ref id="cbm_k_open" name="cbm_k_open">,
1949 <ref id="cbm_k_clall" name="cbm_k_clall">
1955 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1959 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1960 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1961 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1962 <tag/Description/It sets the
1963 current input device to the keyboard, and the current output device to
1964 the screen. Also, if the current input device was formerly a serial
1965 device, the routine sends it an UNTALK command on the serial bus, and
1966 if a serial device was formerly the current output device, the routine
1967 sends it an UNLISTEN command.
1968 <tag/Notes/<itemize>
1971 <tag/Availability/cc65
1973 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
1974 <ref id="cbm_k_ckout" name="cbm_k_ckout">
1980 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
1984 <tag/Function/Get One Byte from the Input Device
1985 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1986 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
1987 <tag/Description/Function gets a character from the current input device.
1988 <tag/Notes/<itemize>
1991 <tag/Availability/cc65
1993 <ref id="cbm_k_basin" name="cbm_k_basin">
1999 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
2003 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
2004 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2005 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
2006 <tag/Description/This function returns the address of
2007 the memory section where the memory mapped I/O devices are located. This
2008 address can then be used with an offset to access the memory mapped I/O
2009 devices in the Commodore 64. The offset is the number of locations from
2010 the beginning of the page on which the I/O register you want is located.
2011 This function exists to provide compatibility between the Commodore 64,
2012 VIC-20, and future models of the Commodore 64. If the I/O locations for
2013 a program are set by a call to this function, they should
2014 still remain compatible with future versions of the Commodore 64, the
2016 <tag/Notes/<itemize>
2019 <tag/Availability/cc65
2027 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
2031 <tag/Function/Command a device on the serial bus to LISTEN
2032 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2033 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
2034 <tag/Description/This function will command a device on the serial bus to
2035 receive data. The KERNAL routine will OR the supplied device number bit by bit
2036 to convert it to a listen address, then transmits this data as a command on
2037 the serial bus. The specified device will then go into listen mode, and
2038 be ready to accept information.
2039 <tag/Notes/<itemize>
2040 <item>The function is only available as fastcall function, so it may
2041 only be used in presence of a prototype.
2043 <tag/Availability/cc65
2045 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
2051 <sect1>cbm_k_load<label id="cbm_k_load"><p>
2055 <tag/Function/Load RAM from a Device
2056 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2057 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
2058 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
2059 It can also be used for a verify operation, comparing data from a device with the data already in
2060 memory, while leaving the data stored in RAM unchanged.
2061 The flag must be set to 0 for a LOAD operation, or 1 for a
2062 verify, If the input device is OPENed with a secondary address (SA) of 0
2063 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
2064 If the device is addressed with a secondary address of 1, then the data is
2065 loaded into memory starting at the location specified by the header.
2066 Function returns the address of the highest RAM location loaded.
2067 Before this function can be called, the KERNAL SETLFS, and SETNAM
2068 routines must be called.
2069 <tag/Notes/<itemize>
2070 <item>The function is only available as fastcall function, so it may
2071 only be used in presence of a prototype.
2073 <tag/Availability/cc65
2075 <ref id="cbm_k_save" name="cbm_k_save">,
2076 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2077 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2083 <sect1>cbm_k_open<label id="cbm_k_open"><p>
2087 <tag/Function/Open a Logical I/O File
2088 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2089 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
2090 <tag/Description/This function assigns a logical file to a device, so that it can be used for
2091 Input/Output operations. In order to specify the logical file number,
2092 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
2093 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
2094 functions are called, cbm_k_open() is then called.
2095 <tag/Notes/<itemize>
2098 <tag/Availability/cc65
2100 <ref id="cbm_k_close" name="cbm_k_close">,
2101 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2102 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2108 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
2112 <tag/Function/Read status word
2113 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2114 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
2115 <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.
2116 <tag/Notes/<itemize>
2119 <tag/Availability/cc65
2127 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2131 <tag/Function/Save RAM to a Device
2132 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2133 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2134 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2135 used before calling this function. However, a file name is not required to
2136 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2137 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.
2138 <tag/Notes/<itemize>
2139 <item>The function is only available as fastcall function, so it may
2140 only be used in presence of a prototype.
2142 <tag/Availability/cc65
2144 <ref id="cbm_k_load" name="cbm_k_load">,
2145 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2146 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2152 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2156 <tag/Function/Scan the keyboard matrix.
2157 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2158 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2159 <tag/Description/This function looks at the switches in the keyboard, to see
2160 if any of them are being pressed. If they are, then code numbers for them are
2161 stored in RAM. Other functions use those numbers to input text. Normally,
2162 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2163 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2164 function, in order to provide input from the keyboard.
2165 <tag/Availability/cc65
2167 <ref id="cbm_k_getin" name="cbm_k_getin">,
2168 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2169 <ref id="cgetc" name="cgetc">,
2170 <!-- <ref id="getc" name="getc"> -->
2171 <!-- <ref id="getchar" name="getchar"> -->
2177 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2181 <tag/Function/Set up a logical file
2182 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2183 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2184 <tag/Description/This functions sets up the logical file by setting its number, device address,
2185 and secondary address.
2186 <tag/Notes/<itemize>
2187 <item>The function is only available as fastcall function, so it may
2188 only be used in presence of a prototype.
2190 <tag/Availability/cc65
2192 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2198 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2202 <tag/Function/Set Filename Parameters
2203 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2204 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2205 <tag/Description/This function is used to set up the file name for the OPEN,
2206 SAVE, or LOAD operations.
2207 <tag/Notes/<itemize>
2208 <item>The function is only available as fastcall function, so it may
2209 only be used in presence of a prototype.
2211 <tag/Availability/cc65
2213 <ref id="cbm_k_open" name="cbm_k_open">,
2214 <ref id="cbm_k_load" name="cbm_k_load">,
2215 <ref id="cbm_k_save" name="cbm_k_save">
2221 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2225 <tag/Function/Commands device to TALK
2226 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2227 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2228 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2229 bus. This commands the device to TALK.
2230 <tag/Notes/<itemize>
2231 <item>The function is only available as fastcall function, so it may
2232 only be used in presence of a prototype.
2234 <tag/Availability/cc65
2236 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2242 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2246 <tag/Function/Update the Jiffy clock.
2247 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2248 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2249 <tag/Description/This function adds one count to the Jiffy clock. That clock
2250 counts sixtieths of a second. It is used by the library's <tt/clock()/
2251 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2252 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2253 then that ISR must call this function, in order to keep the clock valid.
2254 <tag/Availability/cc65
2256 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2257 <ref id="clock" name="clock">
2263 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2267 <tag/Function/Send an UNLISTEN command
2268 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2269 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2270 <tag/Description/This function commands all devices on the serial bus to
2271 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2272 function results in an UNLISTEN command being transmitted on the serial
2273 bus. Only devices previously commanded to LISTEN are affected. This
2274 function is normally used after the host computer is finished sending data
2275 to external devices. Sending the UNLISTEN commands the listening devices
2276 to get off the serial bus so it can be used for other purposes.
2277 <tag/Notes/<itemize>
2280 <tag/Availability/cc65
2282 <ref id="cbm_k_listen" name="cbm_k_listen">
2288 <sect1>cclear<label id="cclear"><p>
2292 <tag/Function/Clear part of a line (write a given number of spaces).
2293 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2294 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2295 <tag/Description/The function clears part of a line by writing <tt/length/
2296 spaces in the current text color.
2297 <tag/Notes/<itemize>
2298 <item>The function is only available as fastcall function, so it may
2299 only be used in presence of a prototype.
2301 <tag/Availability/cc65
2303 <ref id="cclearxy" name="cclearxy">,
2304 <ref id="clrscr" name="clrscr">
2310 <sect1>cclearxy<label id="cclearxy"><p>
2314 <tag/Function/Clear part of a line (write a given number of spaces) starting
2315 at a specific screen position.
2316 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2317 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2318 <tag/Description/The function moves the cursor to a specific position, and
2319 will then clear part of the line by writing <tt/length/ spaces in the current
2321 <tag/Notes/<itemize>
2322 <item>The function is only available as fastcall function, so it may
2323 only be used in presence of a prototype.
2325 <tag/Availability/cc65
2327 <ref id="cclear" name="cclear">,
2328 <ref id="clrscr" name="clrscr">
2334 <sect1>cgetc<label id="cgetc"><p>
2338 <tag/Function/Read a character from the keyboard.
2339 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2340 <tag/Declaration/<tt/char cgetc (void);/
2341 <tag/Description/The function reads a character from the keyboard. If there is
2342 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2343 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2344 displayed while waiting.
2345 <tag/Notes/<itemize>
2346 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2347 from that buffer; and, wait only if the buffer is empty.
2348 <item>The keyboard must be scanned periodically, in order for this function to
2349 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2351 <tag/Availability/cc65
2353 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2354 <ref id="cursor" name="cursor">,
2355 <ref id="kbhit" name="kbhit">
2361 <sect1>chline<label id="chline"><p>
2365 <tag/Function/Output a horizontal line in text mode.
2366 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2367 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2368 <tag/Description/The function outputs a horizontal line with the given length
2369 starting at the current cursor position.
2370 <tag/Notes/<itemize>
2371 <item>The character used to draw the horizontal line is system dependent.
2372 If available, a line drawing character is used. Drawing a line that is partially
2373 off screen leads to undefined behaviour.
2374 <item>The function is only available as fastcall function, so it may only be
2375 used in presence of a prototype.
2377 <tag/Availability/cc65
2379 <ref id="chlinexy" name="chlinexy">,
2380 <ref id="cvline" name="cvline">,
2381 <ref id="cvlinexy" name="cvlinexy">
2387 <sect1>chlinexy<label id="chlinexy"><p>
2391 <tag/Function/Output a horizontal line at a given position in text mode.
2392 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2393 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2394 <tag/Description/The function outputs a horizontal line with the given length
2395 starting at a given position.
2396 <tag/Notes/<itemize>
2397 <item>The character used to draw the horizontal line is system dependent.
2398 If available, a line drawing character is used. Drawing a line that is partially
2399 off screen leads to undefined behaviour.
2400 <item>The function is only available as fastcall function, so it may only be
2401 used in presence of a prototype.
2403 <tag/Availability/cc65
2405 <ref id="chline" name="chline">,
2406 <ref id="cvline" name="cvline">,
2407 <ref id="cvlinexy" name="cvlinexy">
2413 <sect1>clearerr<label id="clearerr"><p>
2417 <tag/Function/Clear error and end-of-file status of a stream.
2418 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2419 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2420 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2421 indicators for the stream <tt/f/.
2422 <tag/Notes/<itemize>
2423 <item>The function is only available as fastcall function, so it may only be
2424 used in presence of a prototype.
2426 <tag/Availability/ISO 9899
2428 <ref id="feof" name="feof">,
2429 <ref id="ferror" name="ferror">
2435 <sect1>clock<label id="clock"><p>
2439 <tag/Function/Determine the processor time used.
2440 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2441 <tag/Declaration/<tt/clock_t clock (void);/
2442 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2443 time used by the program. The time is returned in implementation-defined
2444 units. It can be converted to seconds by dividing by the value of the macro
2445 <tt/CLOCKS_PER_SEC/.
2446 <tag/Notes/<itemize>
2447 <item>Since the machines that cc65-generated programs run on cannot run multiple
2448 processes, the function actually will return the time since some
2449 implementation-defined point in the past.
2450 <item>The Jiffy clock must be "running", in order for this function to return
2451 changing values. (See the description of <tt/cbm_k_udtim()/.)
2453 <tag/Availability/ISO 9899
2455 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2456 <ref id="time" name="time">
2462 <sect1>clrscr<label id="clrscr"><p>
2466 <tag/Function/Clear the text screen.
2467 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2468 <tag/Declaration/<tt/void clrscr (void);/
2469 <tag/Description/The function clears the text screen and moves the cursor to
2470 the upper left corner.
2471 <tag/Availability/cc65
2473 <ref id="cclear" name="cclear">,
2474 <ref id="cclearxy" name="cclearxy">
2480 <sect1>close<label id="close"><p>
2484 <tag/Function/Close a file descriptor.
2485 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2486 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2487 <tag/Description/The function closes the given file descriptor. It returns zero
2488 on success and -1 on error. If an error occurs, the cause can be determined by
2489 reading the <tt/errno/ variable.
2490 <tag/Notes/<itemize>
2491 <item>The function is only available as fastcall function, so it may only
2492 be used in presence of a prototype.
2494 <tag/Availability/POSIX 1003.1
2496 <ref id="creat" name="creat">,
2497 <ref id="open" name="open">
2503 <sect1>closedir<label id="closedir"><p>
2507 <tag/Function/Close a directory.
2508 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2509 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2510 <tag/Description/The function closes the given directory descriptor. It returns
2511 zero on success and -1 on error. If an error occurs, the cause can be determined
2512 by reading the <tt/errno/ variable.
2513 <tag/Notes/<itemize>
2514 <item>The function is only available as fastcall function, so it may only
2515 be used in presence of a prototype.
2517 <tag/Availability/POSIX 1003.1
2519 <ref id="opendir" name="opendir">,
2520 <ref id="readdir" name="readdir">
2526 <sect1>cpeekc<label id="cpeekc"><p>
2530 <tag/Function/Get a character from the display memory.
2531 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2532 <tag/Declaration/<tt/char cpeekc (void);/
2533 <tag/Description/The function gets the character that's at the current location
2534 of the cursor in the display screen RAM. That character is converted, if
2535 needed, into the encoding that can be passed to <tt/cputc()/.
2536 <tag/Notes/<itemize>
2537 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2538 done to make it obvious that peeking doesn't move the cursor in any way. Your
2539 program must place the cursor where it wants to peek before it calls any of
2542 <tag/Availability/cc65
2544 <ref id="cpeekcolor" name="cpeekcolor">,
2545 <ref id="cpeekrevers" name="cpeekrevers">,
2546 <ref id="cpeeks" name="cpeeks">,
2547 <ref id="cputc" name="cputc">
2553 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2557 <tag/Function/Get a color from the display memory.
2558 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2559 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2560 <tag/Description/The function gets the color number that's at the current
2561 location of the cursor in the display screen RAM. That number can be passed to
2563 <tag/Notes/<itemize>
2564 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2565 done to make it obvious that peeking doesn't move the cursor in any way. Your
2566 program must place the cursor where it wants to peek before it calls any of
2569 <tag/Availability/cc65
2571 <ref id="cpeekc" name="cpeekc">,
2572 <ref id="cpeekrevers" name="cpeekrevers">,
2573 <ref id="cpeeks" name="cpeeks">,
2574 <ref id="cputc" name="cputc">,
2575 <ref id="textcolor" name="textcolor">
2581 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2585 <tag/Function/Get a reverse-character attribute from the display memory.
2586 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2587 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2588 <tag/Description/The function gets the "reverse-mode" attribute of the
2589 character that's at the current location of the cursor in the display screen
2590 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2591 <tag/Notes/<itemize>
2592 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2593 done to make it obvious that peeking doesn't move the cursor in any way. Your
2594 program must place the cursor where it wants to peek before it calls any of
2597 <tag/Availability/cc65
2599 <ref id="cpeekc" name="cpeekc">,
2600 <ref id="cpeekcolor" name="cpeekcolor">,
2601 <ref id="cpeeks" name="cpeeks">,
2602 <ref id="cputc" name="cputc">,
2603 <ref id="revers" name="revers">
2609 <sect1>cpeeks<label id="cpeeks"><p>
2613 <tag/Function/Get a string from the display memory.
2614 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2615 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2616 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2617 characters that start at the current location of the cursor in the display
2618 screen RAM. Those characters are converted, if needed, into the encoding that
2619 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2620 that's large enough to hold "length + 1" bytes.
2621 <tag/Notes/<itemize>
2622 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2623 done to make it obvious that peeking doesn't move the cursor in any way. Your
2624 program must place the cursor where it wants to peek before it calls any of
2626 <item>The function is available as only a fastcall function;
2627 so, it may be used only in the presence of a prototype.
2629 <tag/Availability/cc65
2631 <ref id="cpeekc" name="cpeekc">,
2632 <ref id="cpeekcolor" name="cpeekcolor">,
2633 <ref id="cpeekrevers" name="cpeekrevers">,
2634 <ref id="cputc" name="cputc">,
2635 <ref id="cputs" name="cputs">
2641 <sect1>creat<label id="creat"><p>
2645 <tag/Function/Create a file.
2646 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2647 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2648 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2649 associated with it. On error, -1 is returned and an error code is stored in
2651 <tag/Notes/<itemize>
2652 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2653 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2654 <item>The function is only available as fastcall function, so it may only
2655 be used in presence of a prototype.
2657 <tag/Availability/POSIX 1003.1
2659 <ref id="close" name="close">,
2660 <ref id="open" name="open">
2666 <sect1>cprintf<label id="cprintf"><p>
2670 <tag/Function/Formatted output to the console.
2671 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2672 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2673 <tag/Description/The arguments are converted to text where necessary and
2674 formatted according to the format string given. The resulting string is output
2675 to the console. <tt/cprintf/ supports the same format specifiers as
2676 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2677 <tag/Notes/<itemize>
2678 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2679 between <tt/\r/ and <tt/\n/.
2681 <tag/Availability/cc65
2683 <ref id="cputc" name="cputc">,
2684 <ref id="cputcxy" name="cputcxy">,
2685 <ref id="cputs" name="cputs">,
2686 <ref id="cputsxy" name="cputsxy">,
2687 <ref id="vcprintf" name="vcprintf">
2693 <sect1>cputc<label id="cputc"><p>
2697 <tag/Function/Output a character directly to the console.
2698 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2699 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2700 <tag/Description/Output one character to the console at the current cursor
2702 <tag/Notes/<itemize>
2703 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2704 between <tt/\r/ and <tt/\n/.
2705 <item>The function is only available as fastcall function, so it may only
2706 be used in presence of a prototype.
2708 <tag/Availability/cc65
2710 <ref id="cprintf" name="cprintf">,
2711 <ref id="cputcxy" name="cputcxy">,
2712 <ref id="cputs" name="cputs">,
2713 <ref id="cputsxy" name="cputsxy">,
2714 <ref id="vcprintf" name="vcprintf">
2720 <sect1>cputcxy<label id="cputcxy"><p>
2724 <tag/Function/Output a character at a specific screen position.
2725 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2726 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2727 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2728 the screen and outputs one character.
2729 <tag/Notes/<itemize>
2730 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2731 between <tt/\r/ and <tt/\n/.
2732 <item>The function is only available as fastcall function, so it may only
2733 be used in presence of a prototype.
2735 <tag/Availability/cc65
2737 <ref id="cprintf" name="cprintf">,
2738 <ref id="cputc" name="cputc">,
2739 <ref id="cputs" name="cputs">,
2740 <ref id="cputsxy" name="cputsxy">,
2741 <ref id="vcprintf" name="vcprintf">
2747 <sect1>cputs<label id="cputs"><p>
2751 <tag/Function/Output a string directly to the console.
2752 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2753 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2754 <tag/Description/The function outputs the given string on the console at the
2755 current cursor position.
2756 <tag/Notes/<itemize>
2757 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2758 between <tt/\r/ and <tt/\n/.
2759 <item>The function is only available as fastcall function, so it may only
2760 be used in presence of a prototype.
2762 <tag/Availability/cc65
2764 <ref id="cprintf" name="cprintf">,
2765 <ref id="cputc" name="cputc">,
2766 <ref id="cputcxy" name="cputcxy">,
2767 <ref id="cputsxy" name="cputsxy">,
2768 <ref id="vcprintf" name="vcprintf">
2774 <sect1>cputsxy<label id="cputsxy"><p>
2778 <tag/Function/Output a string to the console at a given position.
2779 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2780 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2781 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2782 and outputs the string <tt/s/.
2783 <tag/Notes/<itemize>
2784 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2785 between <tt/\r/ and <tt/\n/.
2786 <item>The function is only available as fastcall function, so it may only
2787 be used in presence of a prototype.
2789 <tag/Availability/cc65
2791 <ref id="cprintf" name="cprintf">,
2792 <ref id="cputc" name="cputc">,
2793 <ref id="cputcxy" name="cputcxy">,
2794 <ref id="cputs" name="cputs">,
2795 <ref id="vcprintf" name="vcprintf">
2801 <sect1>cursor<label id="cursor"><p>
2805 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2806 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2807 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2808 <tag/Description/If the argument to the function is non zero, a blinking cursor
2809 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2810 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2811 <tag/Notes/<itemize>
2812 <item>The function is only available as fastcall function, so it may only
2813 be used in presence of a prototype.
2815 <tag/Availability/cc65
2817 <ref id="cgetc" name="cgetc">,
2818 <ref id="kbhit" name="kbhit">
2824 <sect1>cvline<label id="cvline"><p>
2828 <tag/Function/Output a vertical line in text mode.
2829 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2830 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2831 <tag/Description/The function outputs a vertical line with the given length
2832 starting at the current cursor position.
2833 <tag/Notes/<itemize>
2834 <item>The character used to draw the vertical line is system dependent.
2835 If available, a line drawing character is used. Drawing a line that is partially
2836 off screen leads to undefined behaviour.
2837 <item>The function is only available as fastcall function, so it may only be
2838 used in presence of a prototype.
2840 <tag/Availability/cc65
2842 <ref id="chline" name="chline">,
2843 <ref id="chlinexy" name="chlinexy">,
2844 <ref id="cvlinexy" name="cvlinexy">
2850 <sect1>cvlinexy<label id="cvlinexy"><p>
2854 <tag/Function/Output a vertical line at a given position in text mode.
2855 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2856 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2857 <tag/Description/The function outputs a vertical line with the given length
2858 starting at a given position.
2859 <tag/Notes/<itemize>
2860 <item>The character used to draw the vertical line is system dependent.
2861 If available, a line drawing character is used. Drawing a line that is partially
2862 off screen leads to undefined behaviour.
2863 <item>The function is only available as fastcall function, so it may only be
2864 used in presence of a prototype.
2866 <tag/Availability/cc65
2868 <ref id="chline" name="chline">,
2869 <ref id="chlinexy" name="chlinexy">,
2870 <ref id="cvline" name="cvline">
2876 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2880 <tag/Function/Uncompress a LZ4-compressed buffer.
2881 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2882 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2883 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2884 <tag/Notes/<itemize>
2885 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2887 <tag/Availability/cc65
2893 <sect1>div<label id="div"><p>
2897 <tag/Function/Divide two ints and return quotient and remainder.
2898 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2899 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2900 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2901 quotient and remainder in a <tt/div_t/ structure.
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/ISO 9899
2914 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
2918 <tag/Function/Determines whether the screen is going to be cleared after program exit.
2919 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
2920 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
2921 <tag/Description/The function returns zero if the screen won't be cleared immediately after
2922 program termination. It returns a non-zero value if it will.
2923 <tag/Notes/<itemize>
2924 <item>Some systems, maybe depending on configuration, immediately clear the screen
2925 after a program exits. Therefore it might be difficult to read
2926 the last messages printed by the program prior to its exit. This function can be used
2927 to decide if a delay or wait for a key press should be executed when then program
2930 <tag/Availability/cc65
2938 printf("Hello World\n");
2939 if (doesclrscrafterexit())
2948 <sect1>em_commit<label id="em_commit"><p>
2952 <tag/Function/Commit changes into extended memory.
2953 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2954 <tag/Declaration/<tt/void em_commit (void);/
2955 <tag/Description/Commit changes in the memory window to extended storage. If
2956 the contents of the memory window have been changed, these changes may be lost
2957 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
2958 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
2959 name="em_copyto">/ are called without calling <tt/em_commit/ first.
2960 <tag/Notes/<itemize>
2961 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
2962 memory window are discarded, it does just mean that the drivers is allowed
2964 <item>The function is only available as fastcall function, so it may only be
2965 used in presence of a prototype.
2966 <item>The function produces undefined results if no extended memory driver is
2969 <tag/Availability/cc65
2971 <ref id="em_load_driver" name="em_load_driver">,
2972 <ref id="em_map" name="em_map">,
2973 <ref id="em_use" name="em_use">
2979 <sect1>em_copyfrom<label id="em_copyfrom"><p>
2983 <tag/Function/Copy from extended into normal memory.
2984 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2985 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
2986 <tag/Description/Copy data from extended memory into linear memory. Source and
2987 target addresses as well as the number of bytes to transfer are specified in
2988 the <tt/em_copy/ structure that is passed as a parameter.
2989 <tag/Notes/<itemize>
2990 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
2991 made any changes to the data in the window, call <tt/<ref id="em_commit"
2992 name="em_commit">/ first, or the changes are lost.
2993 <item>The function is only available as fastcall function, so it may only be
2994 used in presence of a prototype.
2995 <item>The function produces undefined results if no extended memory driver is
2998 <tag/Availability/cc65
3000 <ref id="em_commit" name="em_commit">,
3001 <ref id="em_copyto" name="em_copyto">,
3002 <ref id="em_load_driver" name="em_load_driver">
3008 <sect1>em_copyto<label id="em_copyto"><p>
3012 <tag/Function/Copy from normal into extended memory.
3013 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3014 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3015 <tag/Description/Copy data from linear into extended memory. Source and
3016 target addresses as well as the number of bytes to transfer are specified in
3017 the <tt/em_copy/ structure that is passed as a parameter.
3018 <tag/Notes/<itemize>
3019 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3020 made any changes to the data in the window, call <tt/<ref id="em_commit"
3021 name="em_commit">/ first, or the changes are lost.
3022 <item>The function is only available as fastcall function, so it may only be
3023 used in presence of a prototype.
3024 <item>The function produces undefined results if no extended memory driver is
3027 <tag/Availability/cc65
3029 <ref id="em_commit" name="em_commit">,
3030 <ref id="em_copyfrom" name="em_copyfrom">,
3031 <ref id="em_load_driver" name="em_load_driver">
3037 <sect1>em_install<label id="em_install"><p>
3041 <tag/Function/Install an already loaded extended memory driver.
3042 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3043 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3044 <tag/Description/The function installs an already loaded extended memory driver
3045 and returns an error code. The function may be used to install a driver linked
3046 statically to the program.
3047 <tag/Notes/<itemize>
3048 <item>Not all drivers are able to detect if the supported hardware is really
3050 <item>The function is only available as fastcall function, so it may only be
3051 used in presence of a prototype.
3053 <tag/Availability/cc65
3055 <ref id="em_load_driver" name="em_load_driver">,
3056 <ref id="em_uninstall" name="em_uninstall">,
3057 <ref id="em_unload" name="em_unload">
3063 <sect1>em_load_driver<label id="em_load_driver"><p>
3067 <tag/Function/Load and initialize an extended memory driver.
3068 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3069 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3070 <tag/Description/Load an extended memory driver into memory and initialize
3071 it. The function returns an error code that tells if all this has been
3073 <tag/Notes/<itemize>
3074 <item>Not all drivers are able to detect if the supported hardware is really
3076 <item>The function is only available as fastcall function, so it may only be
3077 used in presence of a prototype.
3078 <item>The driver is loaded by name, so currently you must know the type of
3079 extended memory that should be supported. There is no autodetect capability.
3081 <tag/Availability/cc65
3083 <ref id="em_unload" name="em_unload">
3089 <sect1>em_map<label id="em_map"><p>
3093 <tag/Function/Make a page of extended memory accessible.
3094 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3095 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3096 <tag/Description/The function maps one page of extended memory into linear
3097 memory and returns a pointer to the page frame. Depending on the hardware
3098 and driver, the data is either mapped into the address space or transfered
3099 into a buffer. If you don't need the actual contents of the page (for example
3100 because you're going to overwrite it completely), it is better to call
3101 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3102 data if it is possible to avoid that.
3103 <tag/Notes/<itemize>
3104 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3105 made any changes to the data in the window, call <tt/<ref id="em_commit"
3106 name="em_commit">/ first, or the changes are lost.
3107 <item>The function is only available as fastcall function, so it may only be
3108 used in presence of a prototype.
3109 <item>The function produces undefined results if no extended memory driver is
3112 <tag/Availability/cc65
3114 <ref id="em_commit" name="em_commit">,
3115 <ref id="em_load_driver" name="em_load_driver">,
3116 <ref id="em_use" name="em_use">
3122 <sect1>em_pagecount<label id="em_pagecount"><p>
3126 <tag/Function/Return the number of available extended memory pages.
3127 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3128 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3129 <tag/Description/The function returns the size of the extended memory supported
3130 by the driver in 256 byte pages.
3131 <tag/Notes/<itemize>
3132 <item>The function returns zero if no extended memory driver is loaded.
3133 <item>The function may return zero if the supported hardware was not detected.
3135 <tag/Availability/cc65
3137 <ref id="em_load_driver" name="em_load_driver">
3143 <sect1>em_uninstall<label id="em_uninstall"><p>
3147 <tag/Function/Uninstall an already loaded extended memory driver.
3148 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3149 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3150 <tag/Description/The function uninstalls an already loaded extended memory
3151 driver but doesn't remove it from memory.
3152 <tag/Notes/<itemize>
3153 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3154 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3155 should be used instead of <tt/em_uninstall/ so the driver is also removed
3158 <tag/Availability/cc65
3160 <ref id="em_install" name="em_install">,
3161 <ref id="em_load_driver" name="em_load_driver">,
3162 <ref id="em_unload" name="em_unload">
3168 <sect1>em_unload<label id="em_unload"><p>
3172 <tag/Function/Unload an extended memory driver.
3173 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3174 <tag/Declaration/<tt/unsigned char em_unload (void);/
3175 <tag/Description/The function unloads a loaded extended memory driver and
3176 frees all memory allocated for the driver.
3177 <tag/Notes/<itemize>
3178 <item>The function does nothing if no driver is loaded.
3180 <tag/Availability/cc65
3182 <ref id="em_load_driver" name="em_load_driver">
3188 <sect1>em_use<label id="em_use"><p>
3192 <tag/Function/Prepare an extended memory page for use.
3193 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3194 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3195 <tag/Description/The function maps one page of extended memory into linear
3196 memory and returns a pointer to the page frame. This function is similar to
3197 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3198 actual memory window in the assumption that the existing data is wrong or
3199 will get overwritten.
3200 <tag/Notes/<itemize>
3201 <item>Calling <tt/em_use/ 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_load_driver" name="em_load_driver">,
3213 <ref id="em_map" name="em_map">
3219 <sect1>exit<label id="exit"><p>
3223 <tag/Function/Terminate the program.
3224 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3225 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3226 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3227 return code of the program. Before termination, all files are closed, buffered
3228 output is written and any functions registered with <tt/<ref id="atexit"
3229 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3230 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3232 <tag/Notes/<itemize>
3233 <item>The function is only available as fastcall function, so it may only
3234 be used in presence of a prototype.
3235 <item>It depends on the host machine if the program return code can be
3236 evaluated or is ignored.
3238 <tag/Availability/ISO 9899
3240 <ref id="abort" name="abort">,
3241 <ref id="exit" name="exit">
3247 <sect1>exec<label id="exec"><p>
3251 <tag/Function/Execute a program file.
3252 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3253 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3254 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3255 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3256 then loading and starting the program named in the first argument, passing
3257 the command line specified as second argument. Instead of an empty string,
3258 a <tt/NULL/ pointer may be passed as second parameter.
3259 On success, the function does not return. On failure, -1 is returned and
3260 <tt/errno/ contains an error code.
3261 <tag/Notes/<itemize>
3262 <item>The function is only available as fastcall function, so it may only
3263 be used in presence of a prototype.
3264 <item>On most platforms, the function needs to copy a small stub loader to
3265 some memory area outside the program space. This may collide with other
3266 programs. See the platform specific docs on this.
3267 <item>Because it is necessary to terminate the running program before the
3268 memory can be reused to load the new one, there is a high chance that the
3269 function may not be able to return on errors.
3270 <item>The command line is passed to the new program in the same way as cc65
3271 programs expect the command line. If the new program is not a cc65 generated
3272 program, it may not be able to read it.
3274 <tag/Availability/cc65
3276 <ref id="exit" name="exit">
3282 <sect1>fast<label id="fast"><p>
3286 <tag/Function/Switch the C128 into 2MHz mode.
3287 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3288 <tag/Declaration/<tt/void fast (void);/
3289 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
3290 will nearly double the speed compared to slow mode.
3291 <tag/Notes/<itemize>
3292 <item>The function is specific to the C128.
3293 <item>2MHz clock will not work in 40 column mode.
3295 <tag/Availability/C128
3297 <ref id="slow" name="slow">,
3298 <ref id="toggle_videomode" name="toggle_videomode">,
3299 <ref id="videomode" name="videomode">
3305 <sect1>feof<label id="feof"><p>
3309 <tag/Function/Return the end-of-file indicator of a stream.
3310 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3311 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3312 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3313 <tt/f/, and returns a non zero value if it is set.
3314 <tag/Notes/<itemize>
3315 <item>The indicator is set only after a read past the end of a file is
3317 <item>The function is only available as fastcall function, so it may only be
3318 used in presence of a prototype.
3320 <tag/Availability/ISO 9899
3322 <ref id="feof" name="clearerr">,
3323 <ref id="ferror" name="ferror">
3329 <sect1>ferror<label id="ferror"><p>
3333 <tag/Function/Return the error indicator of a stream.
3334 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3335 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3336 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3337 <tt/f/, and returns a non zero value if it is set.
3338 <tag/Notes/<itemize>
3339 <item>The function is only available as fastcall function, so it may only be
3340 used in presence of a prototype.
3342 <tag/Availability/ISO 9899
3344 <ref id="feof" name="clearerr">,
3345 <ref id="ferror" name="feof">
3351 <sect1>fileno<label id="fileno"><p>
3355 <tag/Function/Return the file handle used by a stream.
3356 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3357 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3358 <tag/Description/The <tt/fileno/ function returns the file handle used
3359 internally by a C stream. This file handle (an integer) can be used as a
3360 handle for the POSIX input/output functions.
3361 <tag/Notes/<itemize>
3362 <item>The function is only available as fastcall function, so it may only be
3363 used in presence of a prototype.
3364 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3365 file may have unpredictable results.
3367 <tag/Availability/POSIX 1003.1
3369 <ref id="creat" name="creat">,
3370 <ref id="open" name="open"> <!-- , -->
3371 <!-- <ref id="read" name="read">, -->
3372 <!-- <ref id="write" name="write"> -->
3378 <sect1>free<label id="free"><p>
3382 <tag/Function/Free a block of dynamic memory.
3383 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3384 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3385 <tag/Description/Free a block of dynamic memory previously allocated with
3386 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3387 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3388 pointer is <tt/NULL/, no action is performed.
3389 <tag/Notes/<itemize>
3390 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3391 behaviour and may crash your program.
3392 <item>The function is only available as fastcall function, so it may only
3393 be used in presence of a prototype.
3395 <tag/Availability/ISO 9899
3397 <ref id="_heapadd" name="_heapadd">,
3398 <ref id="_heapblocksize" name="_heapblocksize">,
3399 <ref id="_heapmaxavail" name="_heapmaxavail">,
3400 <ref id="_heapmemavail" name="_heapmemavail">,
3401 <ref id="calloc" name="calloc">,
3402 <ref id="malloc" name="malloc">,
3403 <ref id="realloc" name="realloc">
3409 <sect1>get_ostype<label id="get_ostype"><p>
3413 <tag/Function/The function returns the operating system, the program runs on.
3414 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3415 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3416 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3417 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3418 all supported targets. If it exists, it returns a number that identifies the
3419 operating system or machine type, the program runs on. The machine dependent
3420 header files define constants that can be used to check the return code.
3421 <tag/Notes/<itemize>
3422 <item>The function does not exist on all platforms.
3423 <item>The return codes are platform dependent.
3425 <tag/Availability/cc65 (not all platforms)
3431 <sect1>getcpu<label id="getcpu"><p>
3435 <tag/Function/Determine on which CPU the program is running.
3436 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3437 <tag/Declaration/<tt/unsigned char getcpu (void);/
3438 <tag/Description/The function checks on which CPU the code is running. It
3439 returns one of the constants<itemize>
3441 <item><tt/CPU_65C02/
3442 <item><tt/CPU_65816/
3444 <tag/Notes/<itemize>
3445 <item>Other, more exotic CPU types are not disinguished.
3447 <tag/Availability/cc65
3453 <sect1>getenv<label id="getenv"><p>
3457 <tag/Function/Return a value from the environment.
3458 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3459 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3460 <tag/Description/The function searches the environment for an entry that
3461 matches <tt/name/ and returns its value. The environment consists of a list
3462 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3464 <tag/Notes/<itemize>
3465 <item>What exactly is stored in the environment depends on the machine the
3466 program is running on.
3467 <item>The function is only available as fastcall function, so it may only
3468 be used in presence of a prototype.
3470 <tag/Availability/ISO 9899
3476 <sect1>getopt<label id="getopt"><p>
3480 <tag/Function/Parse command line options.
3481 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3482 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3483 const char* optstring);/
3484 <tag/Description/The function parses command line arguments, <tt/argc/ and
3485 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3486 is a string that contains command line option characters. If a character in
3487 <tt/optstring/ is followed by a colon, the option requires an argument. An
3488 option on the command line is recognized if it is one of the option characters
3490 <tt/getopt/ must be called repeatedly. It will return each option character
3491 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3492 option argument is placed in <tt/optarg/, the index of the next element on the
3493 command line to be processed is placed in <tt/optind/.
3494 <tag/Notes/<itemize>
3495 <item>The implementation will not reorder options. A non option on the command
3496 line will terminate option processing. All remaining arguments are not
3497 recognized as options, even if the start with a '-' character.
3498 <item>The function is only available as fastcall function, so it may only
3499 be used in presence of a prototype.
3501 <tag/Availability/POSIX.2
3507 <sect1>gotox<label id="gotox"><p>
3511 <tag/Function/Move the text mode cursor to a new X position.
3512 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3513 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3514 <tag/Description/The function moves the text mode cursor to the specified X
3515 position while leaving the Y position untouched. The leftmost position on the
3516 screen has the coordinate 0.
3517 <tag/Notes/<itemize>
3518 <item>The function is only available as fastcall function, so it may
3519 only be used in presence of a prototype.
3520 <item>Invalid values for the X position (out of screen coordinates) may
3521 lead to undefined behaviour.
3523 <tag/Availability/cc65
3525 <ref id="gotoy" name="gotoy">,
3526 <ref id="gotoxy" name="gotoxy">,
3527 <ref id="wherex" name="wherex">,
3528 <ref id="wherey" name="wherey">
3534 <sect1>gotoxy<label id="gotoxy"><p>
3538 <tag/Function/Move the text mode cursor to a new position.
3539 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3540 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3541 <tag/Description/The function moves the text mode cursor to the specified
3542 position. The leftmost position on the screen has the X coordinate 0, the
3543 topmost line has the Y coordinate 0.
3544 <tag/Notes/<itemize>
3545 <item>The function is only available as fastcall function, so it may only be
3546 used in presence of a prototype.
3547 <item>Invalid values for any of both coordinates (out of screen positions) may
3548 lead to undefined behaviour.
3550 <tag/Availability/cc65
3552 <ref id="gotox" name="gotox">,
3553 <ref id="gotoy" name="gotoy">,
3554 <ref id="wherex" name="wherex">,
3555 <ref id="wherey" name="wherey">
3561 <sect1>gotoy<label id="gotoy"><p>
3565 <tag/Function/Move the text mode cursor to a new Y position.
3566 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3567 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3568 <tag/Description/The function moves the text mode cursor to the specified Y
3569 position while leaving the X position untouched. The uppermost position on the
3570 screen has the coordinate 0.
3571 <tag/Notes/<itemize>
3572 <item>The function is only available as fastcall function, so it may
3573 only be used in presence of a prototype.
3574 <item>Invalid values for the Y position (out of screen coordinates) may lead
3575 to undefined behaviour.
3577 <tag/Availability/cc65
3579 <ref id="gotox" name="gotox">,
3580 <ref id="gotoxy" name="gotoxy">,
3581 <ref id="wherex" name="wherex">,
3582 <ref id="wherey" name="wherey">
3588 <sect1>isalnum<label id="isalnum"><p>
3592 <tag/Function/Check if a given character is a letter or digit.
3593 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3594 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3595 <tag/Description/The function returns a non zero value if the given argument
3596 is a letter or digit. The return value is zero if the character is anything
3598 <tag/Notes/<itemize>
3599 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3600 inline sequence generated by the macro will not work correctly for values
3601 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3602 this range. The non inline function may be accessed by <tt/#undef/'ing
3604 <item>When compiling without <tt/-Os/, the function is only available as
3605 fastcall function, so it may only be used in presence of a prototype.
3607 <tag/Availability/ISO 9899
3609 <ref id="isalpha" name="isalpha">,
3610 <ref id="isascii" name="isascii">,
3611 <ref id="isblank" name="isblank">,
3612 <ref id="iscntrl" name="iscntrl">,
3613 <ref id="isdigit" name="isdigit">,
3614 <ref id="isgraph" name="isgraph">,
3615 <ref id="islower" name="islower">,
3616 <ref id="isprint" name="isprint">,
3617 <ref id="ispunct" name="ispunct">,
3618 <ref id="isspace" name="isspace">,
3619 <ref id="isupper" name="isupper">,
3620 <ref id="isxdigit" name="isxdigit">
3626 <sect1>isalpha<label id="isalpha"><p>
3630 <tag/Function/Check if a given character is a letter.
3631 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3632 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3633 <tag/Description/The function returns a non zero value if the given argument
3634 is a letter. The return value is zero if the character is anything else.
3635 <tag/Notes/<itemize>
3636 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3637 inline sequence generated by the macro will not work correctly for values
3638 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3639 this range. The non inline function may be accessed by <tt/#undef/'ing the
3641 <item>When compiling without <tt/-Os/, the function is only available as
3642 fastcall function, so it may only be used in presence of a prototype.
3644 <tag/Availability/ISO 9899
3646 <ref id="isalnum" name="isalnum">,
3647 <ref id="isascii" name="isascii">,
3648 <ref id="isblank" name="isblank">,
3649 <ref id="iscntrl" name="iscntrl">,
3650 <ref id="isdigit" name="isdigit">,
3651 <ref id="isgraph" name="isgraph">,
3652 <ref id="islower" name="islower">,
3653 <ref id="isprint" name="isprint">,
3654 <ref id="ispunct" name="ispunct">,
3655 <ref id="isspace" name="isspace">,
3656 <ref id="isupper" name="isupper">,
3657 <ref id="isxdigit" name="isxdigit">
3663 <sect1>isascii<label id="isascii"><p>
3667 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3668 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3669 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3670 <tag/Description/The function returns a non zero value if the given argument
3671 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3672 <tag/Notes/<itemize>
3673 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3674 inline sequence generated by the macro will not work correctly for values
3675 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3676 this range. The non inline function may be accessed by <tt/#undef/'ing the
3678 <item>When compiling without <tt/-Os/, the function is only available as
3679 fastcall function, so it may only be used in presence of a prototype.
3681 <tag/Availability/ISO 9899
3683 <ref id="isalnum" name="isalnum">,
3684 <ref id="isalpha" name="isalpha">,
3685 <ref id="isblank" name="isblank">,
3686 <ref id="iscntrl" name="iscntrl">,
3687 <ref id="isdigit" name="isdigit">,
3688 <ref id="isgraph" name="isgraph">,
3689 <ref id="islower" name="islower">,
3690 <ref id="isprint" name="isprint">,
3691 <ref id="ispunct" name="ispunct">,
3692 <ref id="isspace" name="isspace">,
3693 <ref id="isupper" name="isupper">,
3694 <ref id="isxdigit" name="isxdigit">
3700 <sect1>isblank<label id="isblank"><p>
3704 <tag/Function/Check if a given character is a space or tab.
3705 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3706 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3707 <tag/Description/The function returns a non zero value if the given argument
3708 is a space or tab character. The return value is zero if the character is
3710 <tag/Notes/<itemize>
3711 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3712 inline sequence generated by the macro will not work correctly for values
3713 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3714 this range. The non inline function may be accessed by <tt/#undef/'ing the
3716 <item>When compiling without <tt/-Os/, the function is only available as
3717 fastcall function, so it may only be used in presence of a prototype.
3719 <tag/Availability/ISO 9899
3721 <ref id="isalnum" name="isalnum">,
3722 <ref id="isalpha" name="isalpha">,
3723 <ref id="isascii" name="isascii">,
3724 <ref id="iscntrl" name="iscntrl">,
3725 <ref id="isdigit" name="isdigit">,
3726 <ref id="isgraph" name="isgraph">,
3727 <ref id="islower" name="islower">,
3728 <ref id="isprint" name="isprint">,
3729 <ref id="ispunct" name="ispunct">,
3730 <ref id="isspace" name="isspace">,
3731 <ref id="isupper" name="isupper">,
3732 <ref id="isxdigit" name="isxdigit">
3738 <sect1>iscntrl<label id="iscntrl"><p>
3742 <tag/Function/Check if a given character is a control character.
3743 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3744 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3745 <tag/Description/The function returns a non zero value if the given argument
3746 is a control character. The return value is zero if the character is anything
3748 <tag/Notes/<itemize>
3749 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3750 inline sequence generated by the macro will not work correctly for values
3751 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3752 this range. The non inline function may be accessed by <tt/#undef/'ing the
3754 <item>When compiling without <tt/-Os/, the function is only available as
3755 fastcall function, so it may only be used in presence of a prototype.
3757 <tag/Availability/ISO 9899
3759 <ref id="isalnum" name="isalnum">,
3760 <ref id="isalpha" name="isalpha">,
3761 <ref id="isascii" name="isascii">,
3762 <ref id="isblank" name="isblank">,
3763 <ref id="isdigit" name="isdigit">,
3764 <ref id="isgraph" name="isgraph">,
3765 <ref id="islower" name="islower">,
3766 <ref id="isprint" name="isprint">,
3767 <ref id="ispunct" name="ispunct">,
3768 <ref id="isspace" name="isspace">,
3769 <ref id="isupper" name="isupper">,
3770 <ref id="isxdigit" name="isxdigit">
3776 <sect1>isdigit<label id="isdigit"><p>
3780 <tag/Function/Check if a given character is a digit.
3781 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3782 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
3783 <tag/Description/The function returns a non zero value if the given argument
3784 is a digit. The return value is zero if the character is anything else.
3785 <tag/Notes/<itemize>
3786 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3787 inline sequence generated by the macro will not work correctly for values
3788 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3789 this range. The non inline function may be accessed by <tt/#undef/'ing the
3791 <item>When compiling without <tt/-Os/, the function is only available as
3792 fastcall function, so it may only be used in presence of a prototype.
3794 <tag/Availability/ISO 9899
3796 <ref id="isalnum" name="isalnum">,
3797 <ref id="isalpha" name="isalpha">,
3798 <ref id="isascii" name="isascii">,
3799 <ref id="isblank" name="isblank">,
3800 <ref id="iscntrl" name="iscntrl">,
3801 <ref id="isgraph" name="isgraph">,
3802 <ref id="islower" name="islower">,
3803 <ref id="isprint" name="isprint">,
3804 <ref id="ispunct" name="ispunct">,
3805 <ref id="isspace" name="isspace">,
3806 <ref id="isupper" name="isupper">,
3807 <ref id="isxdigit" name="isxdigit">
3813 <sect1>isgraph<label id="isgraph"><p>
3817 <tag/Function/Check if a given character is a printable character (except
3819 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3820 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
3821 <tag/Description/The function returns a non zero value if the given argument
3822 is a printable character with the exception of space. The return value is zero
3823 if the character is anything else.
3824 <tag/Notes/<itemize>
3825 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3826 inline sequence generated by the macro will not work correctly for values
3827 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3828 this range. The non inline function may be accessed by <tt/#undef/'ing the
3830 <item>When compiling without <tt/-Os/, the function is only available as
3831 fastcall function, so it may only be used in presence of a prototype.
3833 <tag/Availability/ISO 9899
3835 <ref id="isalnum" name="isalnum">,
3836 <ref id="isalpha" name="isalpha">,
3837 <ref id="isascii" name="isascii">,
3838 <ref id="isblank" name="isblank">,
3839 <ref id="iscntrl" name="iscntrl">,
3840 <ref id="isdigit" name="isdigit">,
3841 <ref id="islower" name="islower">,
3842 <ref id="isprint" name="isprint">,
3843 <ref id="ispunct" name="ispunct">,
3844 <ref id="isspace" name="isspace">,
3845 <ref id="isupper" name="isupper">,
3846 <ref id="isxdigit" name="isxdigit">
3852 <sect1>islower<label id="islower"><p>
3856 <tag/Function/Check if a given character is a lower case letter.
3857 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3858 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
3859 <tag/Description/The function returns a non zero value if the given argument
3860 is a lower case letter. The return value is zero if the character is anything
3862 <tag/Notes/<itemize>
3863 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3864 inline sequence generated by the macro will not work correctly for values
3865 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3866 this range. The non inline function may be accessed by <tt/#undef/'ing the
3868 <item>When compiling without <tt/-Os/, the function is only available as
3869 fastcall function, so it may only be used in presence of a prototype.
3871 <tag/Availability/ISO 9899
3873 <ref id="isalnum" name="isalnum">,
3874 <ref id="isalpha" name="isalpha">,
3875 <ref id="isascii" name="isascii">,
3876 <ref id="isblank" name="isblank">,
3877 <ref id="iscntrl" name="iscntrl">,
3878 <ref id="isdigit" name="isdigit">,
3879 <ref id="isgraph" name="isgraph">,
3880 <ref id="isprint" name="isprint">,
3881 <ref id="ispunct" name="ispunct">,
3882 <ref id="isspace" name="isspace">,
3883 <ref id="isupper" name="isupper">,
3884 <ref id="isxdigit" name="isxdigit">
3890 <sect1>isprint<label id="isprint"><p>
3894 <tag/Function/Check if a given character is a printable character.
3895 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3896 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
3897 <tag/Description/The function returns a non zero value if the given argument
3898 is a printable character (this includes the space character). The return value
3899 is zero if the character is anything else.
3900 <tag/Notes/<itemize>
3901 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3902 inline sequence generated by the macro will not work correctly for values
3903 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3904 this range. The non inline function may be accessed by <tt/#undef/'ing the
3906 <item>When compiling without <tt/-Os/, the function is only available as
3907 fastcall function, so it may only be used in presence of a prototype.
3909 <tag/Availability/ISO 9899
3911 <ref id="isalnum" name="isalnum">,
3912 <ref id="isalpha" name="isalpha">,
3913 <ref id="isascii" name="isascii">,
3914 <ref id="isblank" name="isblank">,
3915 <ref id="iscntrl" name="iscntrl">,
3916 <ref id="isdigit" name="isdigit">,
3917 <ref id="isgraph" name="isgraph">,
3918 <ref id="islower" name="islower">,
3919 <ref id="ispunct" name="ispunct">,
3920 <ref id="isspace" name="isspace">,
3921 <ref id="isupper" name="isupper">,
3922 <ref id="isxdigit" name="isxdigit">
3928 <sect1>ispunct<label id="ispunct"><p>
3932 <tag/Function/Check if a given character is a printable character but not a
3933 space or an alphanumeric character.
3934 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3935 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
3936 <tag/Description/The function returns a non zero value if the given argument
3937 is a printable character, but not a space or anything alphanumeric. The return
3938 value is zero if the character is anything else.
3939 <tag/Notes/<itemize>
3940 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3941 inline sequence generated by the macro will not work correctly for values
3942 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3943 this range. The non inline function may be accessed by <tt/#undef/'ing the
3945 <item>When compiling without <tt/-Os/, the function is only available as
3946 fastcall function, so it may only be used in presence of a prototype.
3948 <tag/Availability/ISO 9899
3950 <ref id="isalnum" name="isalnum">,
3951 <ref id="isalpha" name="isalpha">,
3952 <ref id="isascii" name="isascii">,
3953 <ref id="isblank" name="isblank">,
3954 <ref id="iscntrl" name="iscntrl">,
3955 <ref id="isdigit" name="isdigit">,
3956 <ref id="isgraph" name="isgraph">,
3957 <ref id="islower" name="islower">,
3958 <ref id="isprint" name="isprint">,
3959 <ref id="isspace" name="isspace">,
3960 <ref id="isupper" name="isupper">,
3961 <ref id="isxdigit" name="isxdigit">
3967 <sect1>isspace<label id="isspace"><p>
3971 <tag/Function/Check if a given character is a white-space character.
3972 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3973 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
3974 <tag/Description/The function returns a non zero value if the given argument
3975 is a white space character. The return value is zero if the character is
3976 anything else. The standard white space characters are: space, formfeed ('\f'),
3977 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
3979 <tag/Notes/<itemize>
3980 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3981 inline sequence generated by the macro will not work correctly for values
3982 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3983 this range. The non inline function may be accessed by <tt/#undef/'ing the
3985 <item>When compiling without <tt/-Os/, the function is only available as
3986 fastcall function, so it may only be used in presence of a prototype.
3988 <tag/Availability/ISO 9899
3990 <ref id="isalnum" name="isalnum">,
3991 <ref id="isalpha" name="isalpha">,
3992 <ref id="isascii" name="isascii">,
3993 <ref id="isblank" name="isblank">,
3994 <ref id="iscntrl" name="iscntrl">,
3995 <ref id="isdigit" name="isdigit">,
3996 <ref id="isgraph" name="isgraph">,
3997 <ref id="islower" name="islower">,
3998 <ref id="isprint" name="isprint">,
3999 <ref id="ispunct" name="ispunct">,
4000 <ref id="isupper" name="isupper">,
4001 <ref id="isxdigit" name="isxdigit">
4007 <sect1>isupper<label id="isupper"><p>
4011 <tag/Function/Check if a given character is an upper case letter.
4012 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4013 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4014 <tag/Description/The function returns a non zero value if the given argument
4015 is an upper case letter. The return value is zero if the character is anything
4017 <tag/Notes/<itemize>
4018 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4019 inline sequence generated by the macro will not work correctly for values
4020 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4021 this range. The non inline function may be accessed by <tt/#undef/'ing the
4023 <item>When compiling without <tt/-Os/, the function is only available as
4024 fastcall function, so it may only be used in presence of a prototype.
4026 <tag/Availability/ISO 9899
4028 <ref id="isalnum" name="isalnum">,
4029 <ref id="isalpha" name="isalpha">,
4030 <ref id="isascii" name="isascii">,
4031 <ref id="isblank" name="isblank">,
4032 <ref id="iscntrl" name="iscntrl">,
4033 <ref id="isdigit" name="isdigit">,
4034 <ref id="isgraph" name="isgraph">,
4035 <ref id="islower" name="islower">,
4036 <ref id="isprint" name="isprint">,
4037 <ref id="ispunct" name="ispunct">,
4038 <ref id="isspace" name="isspace">,
4039 <ref id="isxdigit" name="isxdigit">
4045 <sect1>isxdigit<label id="isxdigit"><p>
4049 <tag/Function/Check if a given character is a hexadecimal digit.
4050 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4051 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4052 <tag/Description/The function returns a non zero value if the given argument
4053 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4054 character is anything else.
4055 <tag/Notes/<itemize>
4056 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4057 inline sequence generated by the macro will not work correctly for values
4058 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4059 this range. The non inline function may be accessed by <tt/#undef/'ing the
4061 <item>When compiling without <tt/-Os/, the function is only available as
4062 fastcall function, so it may only be used in presence of a prototype.
4064 <tag/Availability/ISO 9899
4066 <ref id="isalnum" name="isalnum">,
4067 <ref id="isalpha" name="isalpha">,
4068 <ref id="isascii" name="isascii">,
4069 <ref id="isblank" name="isblank">,
4070 <ref id="iscntrl" name="iscntrl">,
4071 <ref id="isdigit" name="isdigit">,
4072 <ref id="isgraph" name="isgraph">,
4073 <ref id="islower" name="islower">,
4074 <ref id="isprint" name="isprint">,
4075 <ref id="ispunct" name="ispunct">,
4076 <ref id="isspace" name="isspace">,
4077 <ref id="isupper" name="isupper">
4083 <sect1>itoa<label id="itoa"><p>
4087 <tag/Function/Convert an integer into a string.
4088 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4089 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4090 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4091 <tt/radix/ as the base.
4092 <tag/Notes/<itemize>
4093 <item>There are no provisions to prevent a buffer overflow.
4094 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4095 <item>The function is non standard, so it is not available in strict ANSI mode.
4096 You should probably use <tt/sprintf/ instead.
4097 <item>The function is only available as fastcall function, so it may only be
4098 used in presence of a prototype.
4100 <tag/Availability/cc65
4102 <ref id="atoi" name="atoi">,
4103 <ref id="atol" name="atol">,
4104 <ref id="ltoa" name="ltoa">,
4105 <ref id="ultoa" name="ultoa">,
4106 <ref id="utoa" name="utoa">
4112 <sect1>joy_count<label id="joy_count"><p>
4116 <tag/Function/Return the number of joysticks supported by the current driver.
4117 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4118 <tag/Declaration/<tt/unsigned char joy_count (void);/
4119 <tag/Description/The function returns a the number of joysticks supported
4120 by the current joystick driver.
4121 <tag/Notes/<itemize>
4122 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4123 name="joy_load_driver"> before calling this function.
4124 <item>The function returns the number of joysticks supported by the driver.
4125 There's no way to check for the number of actually connected joysticks.
4127 <tag/Availability/cc65
4129 <ref id="joy_load_driver" name="joy_load_driver">,
4130 <ref id="joy_read" name="joy_read">
4136 <sect1>joy_install<label id="joy_install"><p>
4140 <tag/Function/Install an already loaded driver and return an error code.
4141 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4142 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4143 <tag/Description/The function installs a driver that was already loaded into
4144 memory (or linked statically to the program). It returns an error code
4145 (<tt/JOY_ERR_OK/ in case of success).
4146 <tag/Notes/<itemize>
4147 <item>The function is only available as fastcall function, so it may only be
4148 used in presence of a prototype.
4150 <tag/Availability/cc65
4152 <ref id="joy_load_driver" name="joy_load_driver">,
4153 <ref id="joy_uninstall" name="joy_uninstall">,
4154 <ref id="joy_unload" name="joy_unload">
4160 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4164 <tag/Function/Load a driver from disk and install it.
4165 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4166 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4167 <tag/Description/The function loads a driver with the given name from disk
4168 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4169 driver was successfully loaded and installed.
4170 <tag/Notes/<itemize>
4171 <item>The function is only available as fastcall function, so it may only be
4172 used in presence of a prototype.
4174 <tag/Availability/cc65
4176 <ref id="joy_install" name="joy_install">,
4177 <ref id="joy_uninstall" name="joy_uninstall">,
4178 <ref id="joy_unload" name="joy_unload">
4184 <sect1>joy_read<label id="joy_read"><p>
4188 <tag/Function/Read the status of a joystick.
4189 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4190 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4191 <tag/Description/The function reads the status bits for a joystick. The number
4192 of the joystick is passed as parameter. The result may be examined by using one
4193 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4194 <tag/Notes/<itemize>
4195 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4196 name="joy_load_driver"> before calling this function.
4197 <item>The function is only available as fastcall function, so it may only be
4198 used in presence of a prototype.
4200 <tag/Availability/cc65
4202 <ref id="joy_count" name="joy_count">,
4203 <ref id="joy_load_driver" name="joy_load_driver">,
4204 <ref id="joy_unload" name="joy_unload">
4210 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4214 <tag/Function/Uninstall the current joystick driver.
4215 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4216 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4217 <tag/Description/The function uninstalls the currently installed joystick
4218 driver. It does not remove the driver from memory. The function returns an
4219 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4220 <tag/Notes/<itemize>
4221 <item>A joystick driver must be installed using <ref id="joy_install"
4222 name="joy_install"> before calling this function.
4224 <tag/Availability/cc65
4226 <ref id="joy_install" name="joy_install">,
4227 <ref id="joy_load_driver" name="joy_load_driver">,
4228 <ref id="joy_unload" name="joy_unload">
4234 <sect1>joy_unload<label id="joy_unload"><p>
4238 <tag/Function/Uninstall, then unload the current joystick driver.
4239 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4240 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4241 <tag/Description/The function uninstalls the currently installed joystick
4242 driver and removes it from memory. An error code is returned, which is
4243 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4244 <tag/Notes/<itemize>
4245 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4246 name="joy_load_driver"> before calling this function.
4248 <tag/Availability/cc65
4250 <ref id="joy_load_driver" name="joy_load_driver">
4256 <sect1>kbhit<label id="kbhit"><p>
4260 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4261 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4262 <tag/Declaration/<tt/unsigned char kbhit (void);/
4263 <tag/Description/The function returns a value of zero if there is no character
4264 waiting to be read from the keyboard. It returns non zero otherwise.
4265 <tag/Notes/<itemize>
4266 <item>If the system does not support a keyboard buffer (most systems
4267 do), the function is rather useless.
4269 <tag/Availability/cc65
4271 <ref id="cgetc" name="cgetc">,
4272 <ref id="cursor" name="cursor">
4278 <sect1>kbrepeat<label id="kbrepeat"><p>
4282 <tag/Function/Set the keyboard repeat mode.
4283 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4284 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4285 <tag/Description/This function changes which keys have automatic repeat when
4286 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4287 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4288 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4289 it can be restored later.
4290 <tag/Notes/<itemize>
4291 <item>The function is available only as a fastcall function; so, it may be used
4292 only in the presence of a prototype.
4294 <tag/Availability/cc65
4300 <sect1>labs<label id="labs"><p>
4304 <tag/Function/Returns the absolute value of a long integer.
4305 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4306 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4307 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4309 <tag/Notes/<itemize>
4310 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4311 <item>The function is only available as fastcall function, so it may only be
4312 used in presence of a prototype.
4314 <tag/Availability/ISO 9899
4316 <ref id="abs" name="abs">
4322 <sect1>ltoa<label id="ltoa"><p>
4326 <tag/Function/Convert a long integer into a string.
4327 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4328 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4329 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4330 using <tt/radix/ as the base.
4331 <tag/Notes/<itemize>
4332 <item>There are no provisions to prevent a buffer overflow.
4333 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4334 <item>The function is non standard, so it is not available in strict ANSI mode.
4335 You should probably use <tt/sprintf/ instead.
4336 <item>The function is only available as fastcall function, so it may only be
4337 used in presence of a prototype.
4339 <tag/Availability/cc65
4341 <ref id="atoi" name="atoi">,
4342 <ref id="atol" name="atol">,
4343 <ref id="itoa" name="itoa">,
4344 <ref id="ultoa" name="ultoa">,
4345 <ref id="utoa" name="utoa">
4351 <sect1>localeconv<label id="localeconv"><p>
4355 <tag/Function/Returns a pointer to the current locale structure.
4356 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4357 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4358 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4360 <tag/Notes/<itemize>
4361 <item>cc65 supports only the "C" locale, so even after setting a new locale
4362 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4365 <tag/Availability/ISO 9899
4367 <ref id="setlocale" name="setlocale">
4373 <sect1>longjmp<label id="longjmp"><p>
4377 <tag/Function/Non local goto.
4378 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4379 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4380 <tag/Description/The <tt/longjmp/ function restores a program context from the
4381 data in <tt/buf/, which must have been set by a preceeding call to
4382 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4383 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4385 <tag/Notes/<itemize>
4386 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4387 was called with a value of one.
4388 <item>The function is only available as fastcall function, so it may only
4389 be used in presence of a prototype.
4391 <tag/Availability/ISO 9899
4393 <ref id="setjmp" name="setjmp">
4399 <sect1>malloc<label id="malloc"><p>
4403 <tag/Function/Allocate dynamic memory.
4404 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4405 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4406 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4407 pointer to the allocated memory block. On error (not enough memory available),
4408 <tt/malloc/ returns <tt/NULL/.
4409 <tag/Notes/<itemize>
4410 <item>The function is only available as fastcall function, so it may only
4411 be used in presence of a prototype.
4413 <tag/Availability/ISO 9899
4415 <ref id="_heapadd" name="_heapadd">,
4416 <ref id="_heapblocksize" name="_heapblocksize">,
4417 <ref id="_heapmaxavail" name="_heapmaxavail">,
4418 <ref id="_heapmemavail" name="_heapmemavail">,
4419 <ref id="calloc" name="calloc">,
4420 <ref id="free" name="free">,
4421 <ref id="realloc" name="realloc">,
4422 <ref id="strdup" name="strdup">
4428 <sect1>memchr<label id="memchr"><p>
4432 <tag/Function/Search for a character in a block of raw memory.
4433 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4434 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4435 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4436 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4437 that is of size <tt/count/. Upon completion, the function returns a pointer to
4438 the character found, or a null pointer if the character was not found.
4439 <tag/Notes/<itemize>
4440 <item>The function is only available as fastcall function, so it may only
4441 be used in presence of a prototype.
4443 <tag/Availability/ISO 9899
4445 <ref id="strchr" name="strchr">
4451 <sect1>memcmp<label id="memcmp"><p>
4455 <tag/Function/Compare two memory areas.
4456 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4457 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4458 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4459 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4460 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4461 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4462 <tag/Notes/<itemize>
4463 <item>The function is only available as fastcall function, so it may only
4464 be used in presence of a prototype.
4466 <tag/Availability/ISO 9899
4468 <ref id="strcmp" name="strcmp">,
4469 <ref id="memmove" name="memmove">,
4470 <ref id="memset" name="memset">
4476 <sect1>memcpy<label id="memcpy"><p>
4480 <tag/Function/Copy a memory area.
4481 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4482 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4483 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4484 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4486 <tag/Notes/<itemize>
4487 <item>The result is undefined if the memory areas do overlap. Use
4488 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4489 <item>The function is only available as fastcall function, so it may only
4490 be used in presence of a prototype.
4492 <tag/Availability/ISO 9899
4494 <ref id="_swap" name="_swap">,
4495 <ref id="memmove" name="memmove">,
4496 <ref id="memset" name="memset">
4502 <sect1>memmove<label id="memmove"><p>
4506 <tag/Function/Copy a memory area.
4507 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4508 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4509 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4510 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4512 <tag/Notes/<itemize>
4513 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4514 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4515 <item>The function is only available as fastcall function, so it may only
4516 be used in presence of a prototype.
4518 <tag/Availability/ISO 9899
4520 <ref id="_swap" name="_swap">,
4521 <ref id="memcpy" name="memcpy">,
4522 <ref id="memset" name="memset">
4528 <sect1>memset<label id="memset"><p>
4532 <tag/Function/Fill a memory area.
4533 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4534 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4535 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4536 the value <tt/val/. The function returns <tt/p/.
4537 <tag/Notes/<itemize>
4538 <item>The function is only available as fastcall function, so it may only
4539 be used in presence of a prototype.
4541 <tag/Availability/ISO 9899
4543 <ref id="_swap" name="_swap">,
4544 <ref id="bzero" name="bzero">,
4545 <ref id="memcpy" name="memcpy">,
4546 <ref id="memmove" name="memmove">
4552 <sect1>mod_free<label id="mod_free"><p>
4556 <tag/Function/Free a relocatable module.
4557 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4558 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4559 <tag/Description/The function will free a module loaded into memory by use of
4560 the <tt/<ref id="mod_load" name="mod_load">/ function.
4561 <tag/Notes/<itemize>
4562 <item>The pointer passed as parameter is the pointer to the module memory,
4563 not the pointer to the control structure.
4564 <item>The function is available only as a fastcall function; so, it may be used
4565 only in the presence of a prototype.
4567 <tag/Availability/cc65
4569 <ref id="mod_load" name="mod_load">
4575 <sect1>mod_load<label id="mod_load"><p>
4579 <tag/Function/Load a relocatable module.
4580 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4581 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4582 <tag/Description/The function will load a code module into memory and relocate
4583 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4584 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4585 the module just loaded. Possible error codes are:
4587 <item><tt/MLOAD_OK/ - Module load successful
4588 <item><tt/MLOAD_ERR_READ/ - Read error
4589 <item><tt/MLOAD_ERR_HDR/ - Header error
4590 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4591 <item><tt/MLOAD_ERR_FMT/ - Data format error
4592 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4594 <tag/Notes/<itemize>
4595 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4596 relocatable o65 modules for use with this function.
4597 <item>The function is available only as a fastcall function; so, it may be used
4598 only in the presence of a prototype.
4600 <tag/Availability/cc65
4602 <ref id="mod_free" name="mod_free">
4608 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4612 <tag/Function/Specify a bounding box for the mouse cursor.
4613 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4614 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4615 <tag/Description/The function allows to set a bounding box for mouse movement.
4616 <tag/Notes/<itemize>
4617 <item>The function does not check if the mouse cursor is currently within the
4618 given rectangle. Placing the mouse cursor within the bounding box is the
4619 responsibility of the programmer.
4620 <item>While the bounding box may be larger than the actual screen size, the
4621 standard mouse cursor draw routines may fail to set the cursor to coordinates
4622 outside of the screen area. Depending on the platform, you may have to supply
4623 your own mouse cursor routines.
4624 <item>The function is only available as fastcall function, so it may only be
4625 used in presence of a prototype.
4627 <tag/Availability/cc65
4629 <ref id="mouse_getbox" name="mouse_getbox">,
4630 <ref id="mouse_move" name="mouse_move">
4636 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4640 <tag/Function/Return the current bounding box for the mouse cursor.
4641 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4642 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4643 <tag/Description/The function queries the current bounding box for mouse
4645 <tag/Notes/<itemize>
4646 <item>The function is only available as fastcall function, so it may only be
4647 used in presence of a prototype.
4649 <tag/Availability/cc65
4651 <ref id="mouse_move" name="mouse_move">,
4652 <ref id="mouse_setbox" name="mouse_setbox">
4658 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4662 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4663 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4664 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4665 <tag/Description/The function returns a bit mask that encodes the state of the
4666 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4668 <tag/Availability/cc65
4670 <ref id="mouse_info" name="mouse_info">,
4671 <ref id="mouse_pos" name="mouse_pos">
4677 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4681 <tag/Function/Return a readable error message for an error code.
4682 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4683 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4685 <tag/Description/The function returns an error message (in english) for the
4686 error code passed parameter.
4687 <tag/Notes/<itemize>
4688 <item>The function will return "Unknown error" for invalid error codes.
4689 <item>The function is only available as fastcall function, so it may only be
4690 used in presence of a prototype.
4692 <tag/Availability/cc65
4694 <ref id="mouse_load_driver" name="mouse_load_driver">,
4695 <ref id="mouse_uninstall" name="mouse_uninstall">,
4696 <ref id="mouse_unload" name="mouse_unload">
4702 <sect1>mouse_hide<label id="mouse_hide"><p>
4706 <tag/Function/Hide the mouse pointer.
4707 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4708 <tag/Declaration/<tt/void mouse_hide (void);/
4709 <tag/Description/The function hides the mouse pointer. It manages a counter
4710 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4711 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4712 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4714 <tag/Availability/cc65
4716 <ref id="mouse_show" name="mouse_show">
4722 <sect1>mouse_info<label id="mouse_info"><p>
4726 <tag/Function/Return the state of the mouse buttons and the position of the
4728 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4729 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
4730 <tag/Description/The function returns the state of the mouse buttons and the
4731 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
4732 <tag/Notes/<itemize>
4733 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
4734 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
4735 name="mouse_pos">/ instead.
4736 <item>The function is only available as fastcall function, so it may only be
4737 used in presence of a prototype.
4739 <tag/Availability/cc65
4741 <ref id="mouse_buttons" name="mouse_buttons">,
4742 <ref id="mouse_pos" name="mouse_pos">
4748 <sect1>mouse_install<label id="mouse_install"><p>
4752 <tag/Function/Install an already loaded mouse driver.
4753 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4754 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
4755 mouse_callbacks* c, void* driver);/
4756 <tag/Description/The function installs an already loaded mouse driver and
4757 returns an error code. The <tt/mouse_callbacks/ structure passed as first
4758 parameter contains pointers to routines needed to move or hide/show the mouse
4759 pointer. Defaults for these routines are supplied by the library, so if you
4760 can live with these defaults (which are platform specific), just pass a
4761 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
4762 driver linked statically to the program.
4763 <tag/Notes/<itemize>
4764 <item>Not all drivers are able to detect if the supported hardware is really
4766 <item>After installing a driver, the mouse cursor is hidden.
4767 <item>The function is only available as fastcall function, so it may only be
4768 used in presence of a prototype.
4770 <tag/Availability/cc65
4772 <ref id="mouse_load_driver" name="mouse_load_driver">,
4773 <ref id="mouse_uninstall" name="mouse_uninstall">,
4774 <ref id="mouse_unload" name="mouse_unload">
4780 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
4784 <tag/Function/Call the driver specific ioctl function.
4785 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4786 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
4787 <tag/Description/The function calls the IOCTL entry in the mouse driver,
4788 which is driver specific. The <tt/code/ parameter will choose between
4789 different IOCTL functions, and the <tt/data/ depends on code. The
4790 function returns an error code. The purpose of this function is to allow
4791 for driver specific extensions. See the documentation for a specific mouse
4792 driver for supported ioctl calls.
4793 <tag/Notes/<itemize>
4794 <item>Calling this function is non portable, because each driver may
4795 implement different ioctl calls (or none at all).
4796 <item>The function is only available as fastcall function, so it may only be
4797 used in presence of a prototype.
4799 <tag/Availability/cc65
4805 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
4809 <tag/Function/Load and initialize a mouse driver.
4810 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4811 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
4812 mouse_callbacks* c, const char* driver);/
4813 <tag/Description/Load a mouse driver into memory and initialize it. The
4814 function returns an error code that tells if the call has been successful. The
4815 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
4816 routines needed to move or hide/show the mouse pointer. Defaults for these
4817 routines are supplied by the library, so if you can live with these defaults
4818 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
4819 <tag/Notes/<itemize>
4820 <item>The driver is loaded by name, so currently you must know the type of
4821 mouse that should be supported. There is no autodetect capability.
4822 <item>Not all drivers are able to detect if the supported hardware is really
4824 <item>After installing a driver, the mouse cursor is hidden.
4825 <item>The function is only available as fastcall function, so it may only be
4826 used in presence of a prototype.
4828 <tag/Availability/cc65
4830 <ref id="mouse_install" name="mouse_install">,
4831 <ref id="mouse_uninstall" name="mouse_uninstall">,
4832 <ref id="mouse_unload" name="mouse_unload">
4838 <sect1>mouse_move<label id="mouse_move"><p>
4842 <tag/Function/Move the mouse cursor to a specific position.
4843 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4844 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
4845 <tag/Description/The function updates the mouse position. If the mouse cursor
4846 is visible, it is shown at the new position.
4847 <tag/Notes/<itemize>
4848 <item>The function does not check if the new position is within the bounding
4849 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
4850 <item>The function is only available as fastcall function, so it may only be
4851 used in presence of a prototype.
4853 <tag/Availability/cc65
4855 <ref id="mouse_getbox" name="mouse_getbox">,
4856 <ref id="mouse_setbox" name="mouse_setbox">
4862 <sect1>mouse_pos<label id="mouse_pos"><p>
4866 <tag/Function/Return the position of the mouse.
4867 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4868 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
4869 <tag/Description/The function returns the position of the mouse in the
4870 <tt/mouse_pos/ structure passed as parameter.
4871 <tag/Notes/<itemize>
4872 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
4873 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
4874 name="mouse_info">/ instead.
4875 <item>The function is only available as fastcall function, so it may only be
4876 used in presence of a prototype.
4878 <tag/Availability/cc65
4880 <ref id="mouse_buttons" name="mouse_buttons">,
4881 <ref id="mouse_info" name="mouse_info">
4887 <sect1>mouse_show<label id="mouse_show"><p>
4891 <tag/Function/Show the mouse pointer.
4892 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4893 <tag/Declaration/<tt/void mouse_show (void);/
4894 <tag/Description/The function shows the mouse pointer. It manages a counter
4895 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
4896 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
4897 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
4898 <tag/Availability/cc65
4900 <ref id="mouse_hide" name="mouse_hide">
4906 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
4910 <tag/Function/Uninstall an already loaded mouse driver.
4911 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4912 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
4913 <tag/Description/The function uninstalls an already loaded mouse driver but
4914 don't removes it from memory.
4915 <tag/Notes/<itemize>
4916 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
4917 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
4918 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
4921 <tag/Availability/cc65
4923 <ref id="mouse_install" name="mouse_install">,
4924 <ref id="mouse_load_driver" name="mouse_load_driver">,
4925 <ref id="mouse_unload" name="mouse_unload">
4931 <sect1>mouse_unload<label id="mouse_unload"><p>
4935 <tag/Function/Unload a mouse driver.
4936 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4937 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
4938 <tag/Description/The function unloads a loaded mouse driver and frees all
4939 memory allocated for the driver.
4940 <tag/Notes/<itemize>
4941 <item>The function does nothing if no driver is loaded.
4943 <tag/Availability/cc65
4945 <ref id="mouse_install" name="mouse_install">,
4946 <ref id="mouse_load_driver" name="mouse_load_driver">,
4947 <ref id="mouse_uninstall" name="mouse_uninstall">
4953 <sect1>offsetof<label id="offsetof"><p>
4957 <tag/Function/Calculate the offset of a struct or union member.
4958 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
4959 <tag/Declaration/<tt/size_t offsetof (type, member);/
4960 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
4961 or <tt/union/ member.
4962 <tag/Notes/<itemize>
4963 <item>The function is actually a macro.
4965 <tag/Availability/ISO 9899
4971 <sect1>open<label id="open"><p>
4975 <tag/Function/Open and possibly create a file.
4976 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
4977 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
4978 <tag/Description/<tt/open/ opens a file and returns the file descriptor
4979 associated with it. On error, -1 is returned and an error code is stored in
4980 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
4981 <tag/Notes/<itemize>
4982 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
4983 open, which is used as the permission mask when a new file is created. While
4984 cc65 allows to pass this argument, it is ignored.
4986 <tag/Availability/POSIX 1003.1
4988 <ref id="close" name="close">,
4989 <ref id="creat" name="creat">
4995 <sect1>opendir<label id="opendir"><p>
4999 <tag/Function/Open a directory.
5000 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5001 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5002 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5003 descriptor associated with it. On error, NULL is returned and an error code is
5004 stored in <tt/errno/.
5005 <tag/Notes/<itemize>
5006 <item>The function is only available as fastcall function, so it may only
5007 be used in presence of a prototype.
5009 <tag/Availability/POSIX 1003.1
5011 <ref id="closedir" name="closedir">,
5012 <ref id="readdir" name="readdir">
5018 <sect1>peekbsys<label id="peekbsys"><p>
5022 <tag/Function/Read one byte from a location in the system bank.
5023 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5024 <tt/<ref id="cbm510.h" name="cbm510.h">/
5025 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5026 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5027 system bank (bank 15) of the CBM PET-II machines and returns it.
5028 <tag/Notes/<itemize>
5029 <item>The function is only available as fastcall function, so it may only
5030 be used in presence of a prototype.
5031 <item>This function may be a macro depending on the compiler options. The
5032 actual function is accessible by #undef'ing the macro.
5034 <tag/Availability/cc65
5036 <ref id="PEEK" name="PEEK">,
5037 <ref id="PEEKW" name="PEEKW">,
5038 <ref id="peekwsys" name="peekwsys">,
5039 <ref id="pokebsys" name="pokebsys">,
5040 <ref id="pokewsys" name="pokewsys">
5046 <sect1>peekwsys<label id="peekwsys"><p>
5050 <tag/Function/Read one word from a location in the system bank.
5051 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5052 <tt/<ref id="cbm510.h" name="cbm510.h">/
5053 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5054 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5055 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5056 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5057 high byte is read from <tt/addr+1/.
5058 <tag/Notes/<itemize>
5059 <item>The function is only available as fastcall function, so it may only
5060 be used in presence of a prototype.
5061 <item>The order in which the two bytes are read is undefined.
5063 <tag/Availability/cc65
5065 <ref id="PEEK" name="PEEK">,
5066 <ref id="PEEKW" name="PEEKW">,
5067 <ref id="peekbsys" name="peekbsys">,
5068 <ref id="pokebsys" name="pokebsys">,
5069 <ref id="pokewsys" name="pokewsys">
5075 <sect1>perror<label id="perror"><p>
5079 <tag/Function/Print an error message for the error in <tt/errno/.
5080 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5081 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5082 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5083 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5084 a blank. Then the error message for the current contents of <tt/errno/ is
5085 printed followed by a newline. The message output is the same as returned by
5086 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5087 <tag/Notes/<itemize>
5088 <item>The function is only available as fastcall function, so it may only
5089 be used in presence of a prototype.
5091 <tag/Availability/ISO 9899
5093 <ref id="_poserror" name="_poserror">,
5094 <ref id="strerror" name="strerror">
5100 <sect1>pokebsys<label id="pokebsys"><p>
5104 <tag/Function/Write one byte to a location in the system bank.
5105 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5106 <tt/<ref id="cbm510.h" name="cbm510.h">/
5107 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5108 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5109 system bank (bank 15) of the CBM PET-II machines.
5110 <tag/Notes/<itemize>
5111 <item>The function is only available as fastcall function, so it may only
5112 be used in presence of a prototype.
5114 <tag/Availability/cc65
5116 <ref id="POKE" name="POKE">,
5117 <ref id="POKEW" name="POKEW">,
5118 <ref id="peekbsys" name="peekbsys">,
5119 <ref id="peekwsys" name="peekwsys">,
5120 <ref id="pokewsys" name="pokewsys">
5126 <sect1>pokewsys<label id="pokewsys"><p>
5130 <tag/Function/Write one word to a location in the system bank.
5131 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5132 <tt/<ref id="cbm510.h" name="cbm510.h">/
5133 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5134 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5135 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5136 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5137 high byte is written to <tt/addr+1/.
5138 <tag/Notes/<itemize>
5139 <item>The function is only available as fastcall function, so it may only
5140 be used in presence of a prototype.
5141 <item>The order in which the two bytes are written is undefined.
5143 <tag/Availability/cc65
5145 <ref id="POKE" name="POKE">,
5146 <ref id="POKEW" name="POKEW">,
5147 <ref id="peekbsys" name="peekbsys">,
5148 <ref id="peekwsys" name="peekwsys">,
5149 <ref id="pokebsys" name="pokebsys">
5155 <sect1>qsort<label id="qsort"><p>
5159 <tag/Function/Sort an array.
5160 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5161 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5162 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5163 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5164 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5165 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5166 the function used to compare the members.
5167 <tag/Notes/<itemize>
5168 <item>If there are multiple members with the same key, the order after calling
5169 the function is undefined.
5170 <item>The function is only available as fastcall function, so it may only
5171 be used in presence of a prototype.
5172 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5175 <tag/Availability/ISO 9899
5177 <ref id="bsearch" name="bsearch">
5183 <sect1>raise<label id="raise"><p>
5187 <tag/Function/Send a signal to the executing program.
5188 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5189 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5190 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5191 program has installed a signal handler for the signal, this signal handler
5192 will be executed. If no handler has been installed, the default action for
5193 the raised signal will be taken. The function returns zero on success,
5195 <tag/Notes/<itemize>
5196 <item>The function is only available as fastcall function, so it may only
5197 be used in presence of a prototype.
5199 <tag/Availability/ISO 9899
5201 <ref id="abort" name="abort">,
5202 <ref id="signal" name="signal">
5208 <sect1>rand<label id="rand"><p>
5212 <tag/Function/Return a pseudo random number.
5213 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5214 <tag/Declaration/<tt/int rand (void);/
5215 <tag/Description/The function returns a pseudo random number
5216 between 0 and <tt/RAND_MAX/ (exclusive).
5217 <tag/Notes/<itemize>
5218 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5219 flow of numbers is generated.
5220 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5221 had been used with an argument of 1.
5223 <tag/Availability/ISO 9899
5225 <ref id="_randomize" name="_randomize">,
5226 <ref id="srand" name="srand">
5232 <sect1>readdir<label id="readdir"><p>
5236 <tag/Function/Read a directory.
5237 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5238 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5239 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5240 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5241 and returns a pointer to it. If the end of directory is reached, or an error
5242 occurs, NULL is returned. In case of errors, an error code is stored into
5244 <tag/Notes/<itemize>
5245 <item>The function is only available as fastcall function, so it may only
5246 be used in presence of a prototype.
5247 <item>The returned pointer may point to a statically allocated instance of
5248 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5250 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5251 confused when opening/closing files between directory reads. So for example a
5252 program that reads the list of files on a disk, and after each call to
5253 <tt/readdir/, opens the file to process it, will fail.<newline>
5254 Possible solutions are reading the directory into memory before processing the
5255 file list, or to reset the directory by seeking to the correct position after
5256 opening/closing a file:
5258 seekdir (DIR, telldir (DIR));
5260 Platforms known to work without problems are: Apple.
5262 <tag/Availability/POSIX 1003.1
5264 <ref id="closedir" name="closedir">,
5265 <ref id="opendir" name="opendir">
5271 <sect1>realloc<label id="realloc"><p>
5275 <tag/Function/Change the size of an allocated memory block.
5276 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5277 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5278 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5279 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5280 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5281 behaves as if <tt/free/ had been called. On error (not enough memory
5282 available), <tt/realloc/ returns <tt/NULL/.
5283 <tag/Notes/<itemize>
5284 <item>The part of the memory block that is returned will have its contents
5286 <item>This function is somewhat dangerous to use. Be careful to save the
5287 pointer you're passing somewhere else, otherwise
5289 ptr = realloc (ptr, size);
5291 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5292 <item>The function is only available as fastcall function, so it may only
5293 be used in presence of a prototype.
5295 <tag/Availability/ISO 9899
5297 <ref id="_heapadd" name="_heapadd">,
5298 <ref id="_heapblocksize" name="_heapblocksize">,
5299 <ref id="_heapmaxavail" name="_heapmaxavail">,
5300 <ref id="_heapmemavail" name="_heapmemavail">,
5301 <ref id="calloc" name="calloc">,
5302 <ref id="free" name="free">,
5303 <ref id="realloc" name="realloc">
5309 <sect1>remove<label id="remove"><p>
5313 <tag/Function/Delete a file.
5314 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5315 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5316 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5317 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5318 code describing the reason for the failure.
5319 <tag/Notes/<itemize>
5320 <item>This function is not available on all cc65 targets (depends on the
5321 availability of file I/O).
5322 <item>The function is only available as fastcall function, so it may only
5323 be used in presence of a prototype.
5325 <tag/Availability/ISO 9899
5327 <ref id="rename" name="rename">,
5328 <ref id="unlink" name="unlink">
5331 #include <stdio.h>
5333 #define FILENAME "helloworld"
5335 if (remove (FILENAME) == 0) {
5336 printf ("We deleted %s successfully\n", FILENAME);
5338 printf ("There was a problem deleting %s\n", FILENAME);
5345 <sect1>rename<label id="rename"><p>
5349 <tag/Function/Rename a file.
5350 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5351 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5352 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5353 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5354 code describing the reason for the failure.
5355 <tag/Notes/<itemize>
5356 <item>This function is not available on all cc65 targets (depends on the
5357 capabilities of the storage devices).
5358 <item>The function is only available as fastcall function, so it may only
5359 be used in presence of a prototype.
5361 <tag/Availability/ISO 9899
5363 <ref id="remove" name="remove">
5366 #include <stdio.h>
5368 #define OLDNAME "textfile.txt"
5369 #define NEWNAME "textfile.bak"
5371 if (rename (OLDNAME, NEWNAME) == 0) {
5372 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5374 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5381 <sect1>reset_brk<label id="reset_brk"><p>
5385 <tag/Function/Resets the break vector to its original value.
5386 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5387 <tag/Declaration/<tt/void reset_brk (void);/
5388 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5389 before a call to <tt/set_brk/.
5390 <tag/Notes/<itemize>
5391 <item>The break vector is reset on program termination, so it's not strictly
5392 necessary to call this function as a part of your clean-up when exitting the program.
5394 <tag/Availability/cc65
5396 <ref id="reset_irq" name="reset_irq">,
5397 <ref id="set_brk" name="set_brk">,
5398 <ref id="set_irq" name="set_irq">
5404 <sect1>reset_irq<label id="reset_irq"><p>
5408 <tag/Function/Resets the C level interrupt request vector.
5409 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5410 <tag/Declaration/<tt/void reset_irq (void);/
5411 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5412 <tag/Notes/<itemize>
5413 <item>The interrupt vector is reset on program termination, so it's not strictly
5414 necessary to call this function as a part of your clean-up when exitting the program.
5416 <tag/Availability/cc65
5418 <ref id="reset_brk" name="reset_brk">,
5419 <ref id="set_brk" name="set_brk">,
5420 <ref id="set_irq" name="set_irq">
5426 <sect1>revers<label id="revers"><p>
5430 <tag/Function/Control revers character display.
5431 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5432 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5433 <tag/Description/If the argument is non zero, the function enables reverse
5434 character display. If the argument is zero, reverse character display is
5435 switched off. The old value of the setting is returned.
5436 <tag/Notes/<itemize>
5437 <item>The function may not be supported by the hardware, in which case
5438 the call is ignored.
5439 <item>The function is only available as fastcall function, so it may only
5440 be used in presence of a prototype.
5442 <tag/Availability/cc65
5444 <ref id="textcolor" name="textcolor">
5450 <sect1>rewinddir<label id="rewinddir"><p>
5454 <tag/Function/Reset a directory stream.
5455 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5456 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5457 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5458 pointed to by <tt/dir/ to the start of the directory.
5459 <tag/Notes/<itemize>
5460 <item>The function is only available as fastcall function, so it may only
5461 be used in presence of a prototype.
5463 <tag/Availability/POSIX 1003.1
5465 <ref id="seekdir" name="seekdir">,
5466 <ref id="telldir" name="telldir">
5472 <sect1>screensize<label id="screensize"><p>
5476 <tag/Function/Return the dimensions of the text mode screen.
5477 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5478 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5479 <tag/Description/The function returns the dimensions of the text mode screen.
5480 <tag/Notes/<itemize>
5481 <item>The function is only available as fastcall function, so it may only
5482 be used in presence of a prototype.
5484 <tag/Availability/cc65
5486 <ref id="gotox" name="gotox">,
5487 <ref id="gotoxy" name="gotoxy">,
5488 <ref id="gotoy" name="gotoy">,
5489 <ref id="wherex" name="wherex">,
5490 <ref id="wherey" name="wherey">
5496 <sect1>seekdir<label id="seekdir"><p>
5500 <tag/Function/Set the position of a directory stream.
5501 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5502 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5503 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5504 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5505 value returned by <tt/<ref id="telldir" name="telldir">/.
5506 <tag/Notes/<itemize>
5507 <item>The function is only available as fastcall function, so it may only
5508 be used in presence of a prototype.
5510 <tag/Availability/POSIX 1003.1
5512 <ref id="rewinddir" name="rewinddir">,
5513 <ref id="telldir" name="telldir">
5519 <sect1>ser_close<label id="ser_close"><p>
5523 <tag/Function/Close the port and disable interrupts
5524 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5525 <tag/Declaration/<tt/unsigned char ser_close (void);/
5526 <tag/Description/Close the port by clearing buffers and disable interrupts.
5527 <tag/Availability/cc65
5528 <tag/See also/Other serial functions.
5533 static void initialize(){
5534 struct ser_params params = {
5541 ser_install(lynx_comlynx); // This will activate the ComLynx
5543 ser_open(&params);
5550 <sect1>ser_get<label id="ser_get"><p>
5554 <tag/Function/Read a character from serial port.
5555 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5556 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5557 <tag/Description/Get a character from the serial port. If no characters are
5558 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5560 <tag/Notes/<itemize>
5561 <item>The function is only available as fastcall function, so it may only
5562 be used in presence of a prototype.
5564 <tag/Availability/cc65
5565 <tag/See also/Other serial functions.
5567 Wait for a character to be available from a serial port.
5570 while (ser_get(&ch) == SER_ERR_NO_DATA)
5577 <sect1>ser_install<label id="ser_install"><p>
5581 <tag/Function/Install an already loaded driver and return an error code.
5582 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5583 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5584 <tag/Description/The function installs a driver that was already loaded into
5585 memory (or linked statically to the program). It returns an error code
5586 (<tt/SER_ERR_OK/ in case of success).
5587 <tag/Notes/<itemize>
5588 <item>The function is only available as fastcall function, so it may only be
5589 used in presence of a prototype.
5591 <tag/Availability/cc65
5593 <ref id="ser_load_driver" name="ser_load_driver">,
5594 <ref id="ser_uninstall" name="ser_uninstall">,
5595 <ref id="ser_unload" name="ser_unload">
5597 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5603 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5607 <tag/Function/Platform dependent code extensions.
5608 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5609 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5610 <tag/Description/Some platforms have extra serial functions that are not
5611 supported by standard serial driver functions. You can extend the driver to support
5612 this extra functionality bt using ser_ioctl functions.
5613 <tag/Notes/<itemize>
5614 <item>The function is only available as fastcall function, so it may only
5615 be used in presence of a prototype.
5616 <item>These functions are not easily portable to other cc65 platforms.
5618 <tag/Availability/cc65
5619 <tag/See also/Other serial functions.
5624 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5628 <tag/Function/Load and install a serial driver.
5629 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5630 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5631 <tag/Description/Load and install the driver by name.
5632 Will just load the driver and check if loading was successful.
5633 <tag/Notes/<itemize>
5634 <item>The function is only available as fastcall function, so it may only
5635 be used in presence of a prototype.
5637 <tag/Availability/cc65
5638 <tag/See also/Other serial functions.
5644 <sect1>ser_open<label id="ser_open"><p>
5648 <tag/Function/Open the port by setting the port parameters and enable interrupts
5649 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5650 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5651 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5652 <tag/Notes/<itemize>
5653 <item>The function is only available as fastcall function, so it may only
5654 be used in presence of a prototype.
5656 <tag/Availability/cc65
5657 <tag/See also/Other serial functions.
5662 static void initialize(){
5663 struct ser_params params = {
5670 ser_install(lynx_comlynx); // This will activate the ComLynx
5672 ser_open(&params);
5679 <sect1>ser_put<label id="ser_put"><p>
5683 <tag/Function/Write a character to a serial port.
5684 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5685 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5686 <tag/Description/Send a character via the serial port. There is a transmit
5687 buffer, but transmitting is not done via interrupt. The function returns
5688 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5689 <tag/Notes/<itemize>
5690 <item>The function is only available as fastcall function, so it may only
5691 be used in presence of a prototype.
5693 <tag/Availability/cc65
5694 <tag/See also/Other serial functions.
5703 <sect1>ser_status<label id="ser_status"><p>
5707 <tag/Function/Return the serial port status.
5708 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5709 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5710 <tag/Description/Return the serial port status.
5711 <tag/Notes/<itemize>
5712 <item>The function is only available as fastcall function, so it may only
5713 be used in presence of a prototype.
5715 <tag/Availability/cc65
5716 <tag/See also/Other serial functions.
5722 <sect1>ser_uninstall<label id="ser_uninstall"><p>
5726 <tag/Function/Uninstall the currently loaded driver but do not unload it.
5727 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5728 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
5729 <tag/Description/Uninstall the currently loaded driver but do not unload it.
5730 <tag/Availability/cc65
5731 <tag/See also/Other serial functions.
5736 <sect1>ser_unload<label id="ser_unload"><p>
5740 <tag/Function/Uninstall, then unload the currently loaded driver.
5741 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5742 <tag/Declaration/<tt/unsigned char ser_unload (void);/
5743 <tag/Description/Uninstall, then unload the currently loaded driver.
5744 <tag/Availability/cc65
5745 <tag/See also/Other serial functions.
5751 <sect1>set_brk<label id="set_brk"><p>
5755 <tag/Function/Set the break vector to a user function.
5756 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5757 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
5758 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
5759 program code by letting the vector point to a user written C function. The
5760 runtime library installs a small stub that saves the registers into global
5761 variables that may be accessed (and changed) by the break handler.
5762 <tag/Notes/<itemize>
5763 <item>The function is only available as fastcall function, so it may only
5764 be used in presence of a prototype.
5765 <item>The stub saves the zero page registers used by the C runtime and switches
5766 to a small break handler stack. This means that it is safe to execute C code,
5767 even if C code was interrupted. Be careful however not to use too many local
5768 variables, and do not enable stack checks for the handler function or any other
5769 function called from it.
5770 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
5771 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
5772 otherwise the <tt/BRK/ instruction will get executed over and over again.
5773 <item>The break vector is reset on program termination, so it's not strictly
5774 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
5775 clean-up when exitting the program.
5777 <tag/Availability/cc65
5779 <ref id="reset_brk" name="reset_brk">
5785 <sect1>set_irq<label id="set_irq"><p>
5789 <tag/Function/Set the C level interrupt request vector to the given address.
5790 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5791 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
5792 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
5793 (IRQs) within the program code by letting the vector point to a user written C
5794 function. The runtime library installs a small stub that saves the zero page
5795 registers used by the C runtime before calling the handler function and restores
5796 them after the handler function returns. Additionally the stub temporarily switches
5797 the C runtime stack to the stack area provided as parameter. If the handler function
5798 was set up to handle a "private", "exclusive" interrupt request source it must
5799 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
5800 interrupt request actually stems from that source. In all other cases it must return
5801 the value <tt/IRQ_NOT_HANDLED/.
5802 <tag/Notes/<itemize>
5803 <item>The function is only available as fastcall function, so it may only
5804 be used in presence of a prototype.
5805 <item>The stub saves the registers and zero page locations used by the C runtime
5806 and switches to the provided stack area. As a consequence, there is some
5807 runtime overhead, but it it is safe to execute C code, even if other C code
5808 was interrupted. Be careful however not to call C library functions, and do not
5809 enable stack checks for the handler function or any other function called from
5811 <item>The interrupt vector is reset on program termination, so it's not strictly
5812 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
5813 clean-up when exitting the program.
5815 <tag/Availability/cc65
5817 <ref id="reset_brk" name="reset_brk">,
5818 <ref id="reset_irq" name="reset_irq">,
5819 <ref id="set_brk" name="set_brk">
5825 <sect1>setjmp<label id="setjmp"><p>
5829 <tag/Function/Save the context for use with <tt/longjmp/.
5830 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
5831 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
5832 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
5833 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
5835 <tag/Notes/<itemize>
5836 <item>The function is only available as fastcall function, so it may only
5837 be used in presence of a prototype.
5838 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
5839 <item><tt/setjmp/ will not save the signal context.
5841 <tag/Availability/ISO 9899
5843 <ref id="longjmp" name="longjmp">
5849 <sect1>setlocale<label id="setlocale"><p>
5853 <tag/Function/Selects a locale.
5854 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
5855 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
5856 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
5857 <tag/Notes/<itemize>
5858 <item>The function is only available as fastcall function, so it may only
5859 be used in presence of a prototype.
5860 <item>cc65 supports only the "C" locale, so calling this function to set a
5861 different locale has no effect.
5863 <tag/Availability/ISO 9899
5865 <ref id="localeconv" name="localeconv">,
5866 <ref id="strcoll" name="strcoll">
5867 <ref id="strxfrm" name="strxfrm">
5873 <sect1>signal<label id="signal"><p>
5877 <tag/Function/Install a signal handler.
5878 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5879 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
5880 <tag/Description/<tt/signal/ installs a handler for the given signal. The
5881 handler may either be a user supplied function, or one of the predefined
5882 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
5883 previous value if the signal , or the special function vector SIG_ERR in
5885 <tag/Notes/<itemize>
5886 <item>The function is only available as fastcall function, so it may only
5887 be used in presence of a prototype.
5889 <tag/Availability/ISO 9899
5891 <ref id="abort" name="abort">,
5892 <ref id="raise" name="raise">
5898 <sect1>sleep<label id="sleep"><p>
5902 <tag/Function/Sleep for a specified amount of time.
5903 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
5904 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
5905 <tag/Description/The function will return after the specified number of
5906 seconds have elapsed.
5907 <tag/Notes/<itemize>
5908 <item>The function is only available as fastcall function, so it may only
5909 be used in presence of a prototype.
5911 <tag/Availability/POSIX 1003.1
5917 <sect1>slow<label id="slow"><p>
5921 <tag/Function/Switch the C128 into 1MHz mode.
5922 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
5923 <tag/Declaration/<tt/void slow (void);/
5924 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
5925 will halve the speed compared to fast mode.
5926 <tag/Notes/<itemize>
5927 <item>The function is specific to the C128.
5929 <tag/Availability/C128
5931 <ref id="fast" name="fast">,
5932 <ref id="toggle_videomode" name="toggle_videomode">,
5933 <ref id="videomode" name="videomode">
5939 <sect1>srand<label id="srand"><p>
5943 <tag/Function/Initialize the pseudo random number generator.
5944 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5945 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
5946 <tag/Description/The function initializes the random number generator using
5947 the given seed. On program startup, the generator behaves as if <tt/srand/ has
5948 been called with an argument of 1.
5949 <tag/Notes/<itemize>
5950 <item>The function is only available as fastcall function, so it may only
5951 be used in presence of a prototype.
5953 <tag/Availability/ISO 9899
5955 <ref id="_randomize" name="_randomize">,
5956 <ref id="rand" name="rand">
5962 <sect1>strcasecmp<label id="strcasecmp"><p>
5966 <tag/Function/Compare two strings case insensitive.
5967 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5968 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
5969 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
5970 as parameters without case sensitivity. It returns a value that is less than
5971 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
5972 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
5973 <tag/Notes/<itemize>
5974 <item>The function is only available as fastcall function, so it may only
5975 be used in presence of a prototype.
5976 <item>The function is not available in strict ANSI mode.
5978 <tag/Availability/cc65
5980 <ref id="strcmp" name="strcmp">,
5981 <ref id="strcoll" name="strcoll">,
5982 <ref id="stricmp" name="stricmp">,
5983 <ref id="strncmp" name="strncmp">,
5984 <ref id="strxfrm" name="strxfrm">
5990 <sect1>strcat<label id="strcat"><p>
5994 <tag/Function/Concatentate two strings.
5995 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5996 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
5997 <tag/Description/The <tt/strcat/ function appends a copy of the string
5998 pointed to by s2 (including the terminating null byte) to the end of the
5999 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6001 <tag/Notes/<itemize>
6002 <item>The function is only available as fastcall function, so it may only
6003 be used in presence of a prototype.
6004 <item>If copying takes place between objects that overlap, the behaviour
6007 <tag/Availability/ISO 9899
6009 <ref id="strcpy" name="strcpy">,
6010 <ref id="strncat" name="strncat">,
6011 <ref id="strncpy" name="strncpy">
6017 <sect1>strchr<label id="strchr"><p>
6021 <tag/Function/Search for a character in a string.
6022 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6023 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6024 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6025 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6026 byte is considered to be part of the string. Upon completion, the function
6027 returns a pointer to the byte, or a null pointer if the byte was not found.
6028 <tag/Notes/<itemize>
6029 <item>The function is only available as fastcall function, so it may only
6030 be used in presence of a prototype.
6032 <tag/Availability/ISO 9899
6034 <ref id="memchr" name="memchr">,
6035 <ref id="strrchr" name="strrchr">
6041 <sect1>strcmp<label id="strcmp"><p>
6045 <tag/Function/Compare two strings.
6046 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6047 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6048 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6049 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6050 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6051 if <tt/s1/ is greater than <tt/s2/.
6052 <tag/Notes/<itemize>
6053 <item>The function is only available as fastcall function, so it may only
6054 be used in presence of a prototype.
6056 <tag/Availability/ISO 9899
6058 <ref id="strcasecmp" name="strcasecmp">,
6059 <ref id="strcoll" name="strcoll">,
6060 <ref id="stricmp" name="stricmp">,
6061 <ref id="strncmp" name="strncmp">
6062 <ref id="strxfrm" name="strxfrm">
6068 <sect1>strcoll<label id="strcoll"><p>
6072 <tag/Function/Compare two strings.
6073 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6074 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6075 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6076 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6077 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6078 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6079 than zero if <tt/s1/ is greater than <tt/s2/.
6080 <tag/Notes/<itemize>
6081 <item>The function is only available as fastcall function, so it may only
6082 be used in presence of a prototype.
6084 <tag/Availability/ISO 9899
6086 <ref id="setlocale" name="setlocale">,
6087 <ref id="strcasecmp" name="strcasecmp">,
6088 <ref id="strcmp" name="strcmp">,
6089 <ref id="stricmp" name="stricmp">,
6090 <ref id="strncmp" name="strncmp">,
6091 <ref id="strxfrm" name="strxfrm">
6097 <sect1>strcpy<label id="strcpy"><p>
6101 <tag/Function/Copy a string.
6102 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6103 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6104 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6105 <tt/s2/ (including the terminating null byte) into the array pointed to by
6106 <tt/s1/. The function will always return <tt/s1/.
6107 <tag/Notes/<itemize>
6108 <item>The function is only available as fastcall function, so it may only
6109 be used in presence of a prototype.
6110 <item>If copying takes place between objects that overlap, the behaviour
6113 <tag/Availability/ISO 9899
6115 <ref id="strcat" name="strcat">,
6116 <ref id="strncat" name="strncat">,
6117 <ref id="strncpy" name="strncpy">
6120 #include <string.h>
6122 static char hello[14];
6124 strcpy (hello, "Hello world!\n");
6130 <sect1>strcspn<label id="strcspn"><p>
6134 <tag/Function/Compute the length of a substring.
6135 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6136 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6137 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6138 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6139 characters contained in the string <tt/set/.
6140 <tag/Notes/<itemize>
6141 <item>The function is only available as fastcall function, so it may only
6142 be used in presence of a prototype.
6144 <tag/Availability/ISO 9899
6146 <ref id="strqtok" name="strqtok">,
6147 <ref id="strspn" name="strspn">,
6148 <ref id="strstr" name="strstr">,
6149 <ref id="strtok" name="strtok">
6155 <sect1>strdup<label id="strdup"><p>
6159 <tag/Function/Allocate a copy of a string on the heap.
6160 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6161 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6162 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6163 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6164 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6165 memory block, and a pointer to the block is returned.
6166 <tag/Notes/<itemize>
6167 <item>The function is only available as fastcall function, so it may only
6168 be used in presence of a prototype.
6169 <item>It is up to the caller to free the allocated memory block.
6171 <tag/Availability/ISO 9899
6173 <ref id="free" name="free">,
6174 <ref id="malloc" name="malloc">
6180 <sect1>strerror<label id="strerror"><p>
6184 <tag/Function/Return a string describing an error code.
6185 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6186 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6187 <tag/Description/The <tt/strerror/ function returns a string describing the
6188 given error code. If an invalid error code is passed, the string "Unknown
6189 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6190 <tt/errno/ is left untouched.
6191 <tag/Notes/<itemize>
6192 <item>The function is only available as fastcall function, so it may only
6193 be used in presence of a prototype.
6194 <item>While the return type of the function is a <tt/char*/, the returned
6195 string must not be modified by the caller!
6197 <tag/Availability/ISO 9899
6199 <ref id="_stroserror" name="_stroserror">
6205 <sect1>stricmp<label id="stricmp"><p>
6209 <tag/Function/Compare two strings case insensitive.
6210 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6211 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6212 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6213 parameters without case sensitivity. It returns a value that is less than zero
6214 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6215 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6216 <tag/Notes/<itemize>
6217 <item>The function is only available as fastcall function, so it may only
6218 be used in presence of a prototype.
6219 <item>The function is not available in strict ANSI mode.
6221 <tag/Availability/cc65
6223 <ref id="strcasecmp" name="strcasecmp">,
6224 <ref id="strcmp" name="strcmp">,
6225 <ref id="strcoll" name="strcoll">,
6226 <ref id="strncmp" name="strncmp">,
6227 <ref id="strxfrm" name="strxfrm">
6233 <sect1>strlen<label id="strlen"><p>
6237 <tag/Function/Return the length of a string.
6238 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6239 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6240 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6241 string to which s points, not including the terminating null byte.
6242 <tag/Notes/<itemize>
6243 <item>The function is only available as fastcall function, so it may only
6244 be used in presence of a prototype.
6245 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6246 function does not work correctly for strings with more than 255 characters.
6248 <tag/Availability/ISO 9899
6250 <ref id="strcpy" name="strcpy">
6256 <sect1>strlower<label id="strlower"><p>
6260 <tag/Function/Make a string lower case.
6261 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6262 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6263 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6264 function to each character of a string. The function will always return <tt/s/.
6265 <tag/Notes/<itemize>
6266 <item>The function is only available as fastcall function, so it may only
6267 be used in presence of a prototype.
6268 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6269 <item>An alias name for this function is <tt/strlwr/.
6271 <tag/Availability/cc65
6273 <ref id="strupper" name="strupper">,
6274 <ref id="tolower" name="tolower">
6280 <sect1>strlwr<label id="strlwr"><p>
6287 <sect1>strncat<label id="strncat"><p>
6291 <tag/Function/Concatentate two strings.
6292 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6293 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6294 <tag/Description/The <tt/strncat/ function appends not more than n characters
6295 of the string pointed to by s2 to the end of the string pointed to by s1. The
6296 terminating null character at the end of s1 is overwritten. A terminating null
6297 character is appended to the result, even if not all of s2 is appended to s1.
6298 <tag/Notes/<itemize>
6299 <item>The function is only available as fastcall function, so it may only
6300 be used in presence of a prototype.
6301 <item>If copying takes place between objects that overlap, the behaviour
6304 <tag/Availability/ISO 9899
6306 <ref id="strcpy" name="strcpy">,
6307 <ref id="strncat" name="strncat">,
6308 <ref id="strncpy" name="strncpy">
6314 <sect1>strncmp<label id="strncmp"><p>
6318 <tag/Function/Compare two strings.
6319 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6320 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6321 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6322 characters of the two strings passed as parameters. It returns a value that is
6323 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6324 <tt/s2/, zero if they are identical, and a value greater than zero they are
6326 <tag/Notes/<itemize>
6327 <item>The function is only available as fastcall function, so it may only
6328 be used in presence of a prototype.
6330 <tag/Availability/ISO 9899
6332 <ref id="strcasecmp" name="strcasecmp">,
6333 <ref id="strcmp" name="strcmp">,
6334 <ref id="strcoll" name="strcoll">,
6335 <ref id="stricmp" name="stricmp">,
6336 <ref id="strxfrm" name="strxfrm">
6342 <sect1>strncpy<label id="strncpy"><p>
6346 <tag/Function/Copy part of a string.
6347 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6348 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6349 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6350 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6351 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6352 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6353 written. The function always will return <tt/s1/.
6354 <tag/Notes/<itemize>
6355 <item>The function is available only as a fastcall function; so, it may be used
6356 only in the presence of a prototype.
6357 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6358 to by <tt/s2/, the result is <em/not/ null-terminated!
6359 <item>If copying takes place between objects that overlap, the behaviour is
6362 <tag/Availability/ISO 9899
6364 <ref id="memcpy" name="memcpy">,
6365 <ref id="strcat" name="strcat">,
6366 <ref id="strcpy" name="strcpy">,
6367 <ref id="strncat" name="strncat">
6372 static char hello[6];
6374 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6380 <sect1>strqtok<label id="strqtok"><p>
6384 <tag/Function/Break a string into tokens.
6385 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6386 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6387 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6388 tokens, which are delimited by either quotation marks or characters from the
6389 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6390 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6391 pointer to the first token in the string <tt/s1/. The following calls must pass
6392 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6393 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6394 <tag/Notes/<itemize>
6395 <item>The function is available only as a fastcall function; so, it may be used
6396 only in the presence of a prototype.
6397 <item><tt/strqtok()/ will modify the string <tt/s1/.
6398 <item>The function will forget where it is in the <tt/s1/ string if it is given
6399 a second <tt/s1/ string before it finishes the first one.
6401 <tag/Availability/cc65
6403 <ref id="strcspn" name="strcspn">,
6404 <!-- <ref id="strpbrk" name="strpbrk">, -->
6405 <ref id="strspn" name="strspn">,
6406 <ref id="strtok" name="strtok">
6412 <sect1>strrchr<label id="strrchr"><p>
6416 <tag/Function/Search for a character in a string.
6417 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6418 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6419 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6420 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6421 byte is considered to be part of the string. Upon completion, the function
6422 returns a pointer to the byte, or a null pointer if the byte was not found.
6423 <tag/Notes/<itemize>
6424 <item>The function is only available as fastcall function, so it may only
6425 be used in presence of a prototype.
6427 <tag/Availability/ISO 9899
6429 <ref id="strchr" name="strchr">
6435 <sect1>strspn<label id="strspn"><p>
6439 <tag/Function/Compute the length of a substring.
6440 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6441 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6442 <tag/Description/The <tt/strspn/ function computes and returns the length of
6443 the substring pointed to by <tt/s/ which does consist only of characters
6444 contained in the string <tt/set/.
6445 <tag/Notes/<itemize>
6446 <item>The function is only available as fastcall function, so it may only
6447 be used in presence of a prototype.
6449 <tag/Availability/ISO 9899
6451 <ref id="strcspn" name="strcspn">,
6452 <ref id="strstr" name="strstr">
6458 <sect1>strstr<label id="strstr"><p>
6462 <tag/Function/Find a substring.
6463 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6464 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6465 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6466 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6467 otherwise it returns <tt/NULL/.
6468 <tag/Notes/<itemize>
6469 <item>The function is only available as fastcall function, so it may only
6470 be used in presence of a prototype.
6472 <tag/Availability/ISO 9899
6474 <ref id="strcspn" name="strcspn">,
6475 <ref id="strspn" name="strspn">
6481 <sect1>strtok<label id="strtok"><p>
6485 <tag/Function/Break a string into tokens.
6486 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6487 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6488 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6489 tokens, which are delimited by characters from the string <tt/s2/. The first call
6490 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6491 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6492 the next token in the string. Different sets of delimiters may be used for the
6493 subsequent calls to <tt/strtok()/.
6494 <tag/Notes/<itemize>
6495 <item>The function is only available as fastcall function, so it may only
6496 be used in presence of a prototype.
6497 <item><tt/strtok()/ will modify the string <tt/s1/.
6498 <item>The function will forget where it is in the <tt/s1/ string if it is given
6499 a second <tt/s1/ string before it finishes the first one.
6501 <tag/Availability/ISO 9899
6503 <ref id="strcspn" name="strcspn">,
6504 <!-- <ref id="strpbrk" name="strpbrk">, -->
6505 <ref id="strqtok" name="strqtok">,
6506 <ref id="strspn" name="strspn">
6512 <sect1>strxfrm<label id="strxfrm"><p>
6516 <tag/Function/Transform a string.
6517 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6518 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6519 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6520 s2 and places the resulting string into the string pointed to by s1. The
6521 transformation is such that if the <tt/strcmp/ function is applied to two
6522 transformed strings, it returns a value greater than, equal to, or less than
6523 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6524 same two original strings. No more than n characters are placed into the
6525 resulting array pointed to by s1, including the terminating null character.
6526 <tag/Notes/<itemize>
6527 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6528 the behaviour is undefined.
6529 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6530 <item>The function is only available as fastcall function, so it may only
6531 be used in presence of a prototype.
6532 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6533 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6535 <tag/Availability/ISO 9899
6537 <ref id="strcmp" name="strcmp">,
6538 <ref id="strcoll" name="strcoll">,
6539 <ref id="strncpy" name="strncpy">
6545 <sect1>strupper<label id="strupper"><p>
6549 <tag/Function/Make a string upper case.
6550 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6551 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6552 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6553 function to each character of a string. The function will always return <tt/s/.
6554 <tag/Notes/<itemize>
6555 <item>The function is only available as fastcall function, so it may only
6556 be used in presence of a prototype.
6557 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6558 <item>An alias name for this function is <tt/strupr/.
6560 <tag/Availability/cc65
6562 <ref id="strlower" name="strlower">
6563 <ref id="toupper" name="toupper">
6569 <sect1>strupr<label id="strupr"><p>
6576 <sect1>telldir<label id="telldir"><p>
6580 <tag/Function/Return the current position of a directory stream.
6581 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6582 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6583 <tag/Description/<tt/telldir/ returns the current position of a directory
6584 stream. The return value may be used in subsequent calls to
6585 <tt/<ref id="seekdir" name="seekdir">/.
6586 <tag/Notes/<itemize>
6587 <item>The function is only available as fastcall function, so it may only
6588 be used in presence of a prototype.
6590 <tag/Availability/POSIX 1003.1
6592 <ref id="seekdir" name="seekdir">,
6593 <ref id="telldir" name="telldir">
6599 <sect1>textcolor<label id="textcolor"><p>
6603 <tag/Function/Set the text color.
6604 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6605 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6606 <tag/Description/The function will set a new text color. It returns the old
6607 (current) text color. Text output using any <tt/conio.h/ function will use
6608 the color set by this function.
6609 <tag/Notes/<itemize>
6610 <item>Text colors are system dependent. The function may have no effect
6611 on systems where the text color cannot be changed.
6612 <item>The function is only available as fastcall function, so it may only
6613 be used in presence of a prototype.
6615 <tag/Availability/cc65
6617 <ref id="bgcolor" name="bgcolor">,
6618 <ref id="bordercolor" name="bordercolor">
6624 <sect1>time<label id="time"><p>
6628 <tag/Function/Get the time.
6629 <tag/Header/<tt/<ref id="time.h" name="time.h">/
6630 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
6631 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
6632 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
6633 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
6634 returned and <tt/errno/ is set to <tt/ENOSYS/.
6635 <tag/Notes/<itemize>
6636 <item>The function is only available as fastcall function, so it may
6637 only be used in presence of a prototype.
6638 <item>Many platforms supported by cc65 do not have a realtime clock, so the
6639 returned value may not be valid.
6641 <tag/Availability/ISO 9899
6643 <ref id="clock" name="clock">
6649 <sect1>toggle_videomode<label id="toggle_videomode"><p>
6653 <tag/Function/Toggle between 40 and 80 column mode.
6654 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
6655 <tag/Declaration/<tt/void toggle_videomode (void);/
6656 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
6657 old mode (cursor position, color and so on) are saved and restored together
6659 <tag/Notes/<itemize>
6660 <item>The function is specific to the C128.
6661 <item>This function is deprecated. Please use <ref id="videomode"
6662 name="videomode"> instead!
6664 <tag/Availability/C128
6666 <ref id="fast" name="fast">,
6667 <ref id="slow" name="slow">,
6668 <ref id="videomode" name="videomode">
6674 <sect1>tolower<label id="tolower"><p>
6678 <tag/Function/Convert a character into its lower case representation.
6679 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
6680 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
6681 <tag/Description/The function returns the given character converted to lower
6682 case. If the given character is not a letter, it is returned unchanged.
6683 <tag/Notes/<itemize>
6684 <item>The function is only available as fastcall function, so it may
6685 only be used in presence of a prototype.
6687 <tag/Availability/ISO 9899
6689 <ref id="islower" name="islower">,
6690 <ref id="isupper" name="isupper">,
6691 <ref id="toupper" name="toupper">
6697 <sect1>toupper<label id="toupper"><p>
6701 <tag/Function/Convert a character into its upper case representation.
6702 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
6703 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
6704 <tag/Description/The function returns the given character converted to upper
6705 case. If the given character is not a letter, it is returned unchanged.
6706 <tag/Notes/<itemize>
6707 <item>The function is only available as fastcall function, so it may
6708 only be used in presence of a prototype.
6710 <tag/Availability/ISO 9899
6712 <ref id="islower" name="islower">,
6713 <ref id="isupper" name="isupper">,
6714 <ref id="tolower" name="tolower">
6720 <sect1>ultoa<label id="ultoa"><p>
6724 <tag/Function/Convert an unsigned long integer into a string.
6725 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6726 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
6727 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
6728 string using <tt/radix/ as the base.
6729 <tag/Notes/<itemize>
6730 <item>There are no provisions to prevent a buffer overflow.
6731 <item>The function is non standard, so it is not available in strict ANSI mode.
6732 You should probably use <tt/sprintf/ instead.
6733 <item>The function is only available as fastcall function, so it may only be
6734 used in presence of a prototype.
6736 <tag/Availability/cc65
6738 <ref id="atoi" name="atoi">,
6739 <ref id="atol" name="atol">,
6740 <ref id="itoa" name="itoa">,
6741 <ref id="ltoa" name="ltoa">,
6742 <ref id="utoa" name="utoa">
6748 <sect1>unlink<label id="unlink"><p>
6752 <tag/Function/Delete a file.
6753 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6754 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
6755 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
6756 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
6757 code describing the reason for the failure.
6758 <tag/Notes/<itemize>
6759 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
6760 name="remove">/ instead, which is a native ANSI C function and does the same.
6761 <item>This function is not available on all cc65 targets (depends on the
6762 availability of file I/O).
6763 <item>The function is only available as fastcall function, so it may only
6764 be used in presence of a prototype.
6765 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
6766 used, which has the same semantics, but is more portable, because it conforms
6767 to the ISO C standard.
6769 <tag/Availability/POSIX 1003.1
6771 <ref id="remove" name="remove">
6774 #include <stdio.h>
6775 #include <unistd.h>
6777 #define FILENAME "helloworld"
6779 if (unlink (FILENAME) == 0) {
6780 printf ("We deleted %s successfully\n", FILENAME);
6782 printf ("There was a problem deleting %s\n", FILENAME);
6789 <sect1>utoa<label id="utoa"><p>
6793 <tag/Function/Convert an unsigned integer into a string.
6794 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6795 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
6796 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
6797 using <tt/radix/ as the base.
6798 <tag/Notes/<itemize>
6799 <item>There are no provisions to prevent a buffer overflow.
6800 <item>The function is non standard, so it is not available in strict ANSI mode.
6801 You should probably use <tt/sprintf/ instead.
6802 <item>The function is only available as fastcall function, so it may only be
6803 used in presence of a prototype.
6805 <tag/Availability/cc65
6807 <ref id="atoi" name="atoi">,
6808 <ref id="atol" name="atol">,
6809 <ref id="itoa" name="itoa">,
6810 <ref id="ltoa" name="ltoa">,
6811 <ref id="ultoa" name="ultoa">
6817 <sect1>vcprintf<label id="vcprintf"><p>
6821 <tag/Function/Formatted output to the console.
6822 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6823 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
6824 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
6825 text where necessary and formatted according to the format string given. The
6826 resulting string is output to the console. <tt/vcprintf/ supports the same
6827 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
6828 <tag/Notes/<itemize>
6829 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
6830 between <tt/\r/ and <tt/\n/.
6831 <item>The function is only available as fastcall function, so it may only be
6832 used in presence of a prototype.
6834 <tag/Availability/cc65
6836 <ref id="cprintf" name="cprintf">,
6837 <ref id="cputc" name="cputc">,
6838 <ref id="cputcxy" name="cputcxy">,
6839 <ref id="cputs" name="cputs">,
6840 <ref id="cputsxy" name="cputsxy">
6846 <sect1>videomode<label id="videomode"><p>
6850 <tag/Function/Switch to either 40 or 80 column mode.
6851 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
6852 <ref id="c128.h" name="c128.h">/
6853 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
6854 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
6855 the requested mode is already active, nothing happens. The old mode is returned
6857 <tag/Notes/<itemize>
6858 <item>The function is specific to the C128 and enhanced Apple //e.
6859 <item>This function replaces <ref id="toggle_videomode"
6860 name="toggle_videomode">.
6861 <item>The function is only available as fastcall function, so it may only be
6862 used in presence of a prototype.
6864 <tag/Availability/C128 and enhanced Apple //e
6866 <ref id="fast" name="fast">,
6867 <ref id="slow" name="slow">,
6868 <ref id="toggle_videomode" name="toggle_videomode">
6874 <sect1>waitvsync<label id="waitvsync"><p>
6878 <tag/Function/Wait until the start of the next frame.
6880 <tt/<ref id="cbm.h" name="cbm.h">/,
6881 <tt/<ref id="gamate.h" name="gamate.h">/,
6882 <tt/<ref id="nes.h" name="nes.h">/,
6883 <tt/<ref id="pce.h" name="pce.h">/
6884 <tag/Declaration/<tt/void waitvsync (void);/
6885 <tag/Description/Wait for vertical sync to reduce flickering.
6886 <tag/Availability/Platforms above
6892 <sect1>wherex<label id="wherex"><p>
6896 <tag/Function/Return the current X position of the text mode cursor.
6897 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6898 <tag/Declaration/<tt/unsigned char wherex (void);/
6899 <tag/Description/The function returns the current X position of the text mode
6900 cursor. Zero is returned for the leftmost screen position.
6901 <tag/Availability/cc65
6903 <ref id="gotox" name="gotox">,
6904 <ref id="gotoy" name="gotoy">,
6905 <ref id="gotoxy" name="gotoxy">,
6906 <ref id="wherey" name="wherey">
6912 <sect1>wherey<label id="wherey"><p>
6916 <tag/Function/Return the current Y position of the text mode cursor.
6917 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6918 <tag/Declaration/<tt/unsigned char wherey (void);/
6919 <tag/Description/The function returns the current Y position of the text mode
6920 cursor. Zero is returned for the uppermost screen position.
6921 <tag/Availability/cc65
6923 <ref id="gotox" name="gotox">,
6924 <ref id="gotoy" name="gotoy">,
6925 <ref id="gotoxy" name="gotoxy">,
6926 <ref id="wherex" name="wherex">