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_load" name="atmos_load">
119 <item><ref id="atmos_save" name="atmos_save">
120 <!-- <item><ref id="atmos_explode" name="atmos_explode"> -->
121 <!-- <item><ref id="atmos_ping" name="atmos_ping"> -->
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"> -->
131 <sect1><tt/c128.h/<label id="c128.h"><p>
134 <item><ref id="c64mode" name="c64mode">
135 <item><ref id="fast" name="fast">
136 <item><ref id="slow" name="slow">
137 <item><ref id="toggle_videomode" name="toggle_videomode">
138 <item><ref id="videomode" name="videomode">
142 <sect1><tt/c16.h/<label id="c16.h"><p>
147 <sect1><tt/c64.h/<label id="c64.h"><p>
150 <item><ref id="get_ostype" name="get_ostype">
154 <sect1><tt/cbm.h/<label id="cbm.h"><p>
157 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
158 <item><ref id="cbm_k_basin" name="cbm_k_basin">
159 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
160 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
161 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
162 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
163 <item><ref id="cbm_k_clall" name="cbm_k_clall">
164 <item><ref id="cbm_k_close" name="cbm_k_close">
165 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
166 <item><ref id="cbm_k_getin" name="cbm_k_getin">
167 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
168 <item><ref id="cbm_k_listen" name="cbm_k_listen">
169 <item><ref id="cbm_k_load" name="cbm_k_load">
170 <item><ref id="cbm_k_open" name="cbm_k_open">
171 <item><ref id="cbm_k_readst" name="cbm_k_readst">
172 <item><ref id="cbm_k_save" name="cbm_k_save">
173 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
174 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
175 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
176 <item><ref id="cbm_k_talk" name="cbm_k_talk">
177 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
178 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
179 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
180 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
181 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
182 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
183 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
184 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
185 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
186 <!-- <item><ref id="get_tv" name="get_tv"> -->
187 <item><ref id="kbrepeat" name="kbrepeat">
193 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
196 <item><ref id="peekbsys" name="peekbsys">
197 <item><ref id="peekwsys" name="peekwsys">
198 <item><ref id="pokebsys" name="pokebsys">
199 <item><ref id="pokewsys" name="pokewsys">
203 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
206 <item><ref id="peekbsys" name="peekbsys">
207 <item><ref id="peekwsys" name="peekwsys">
208 <item><ref id="pokebsys" name="pokebsys">
209 <item><ref id="pokewsys" name="pokewsys">
213 <sect1><tt/cc65.h/<label id="cc65.h"><p>
216 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
217 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
218 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
219 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
220 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
221 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
222 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
223 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
224 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
225 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
231 <sect1><tt/conio.h/<label id="conio.h"><p>
234 <item><ref id="bgcolor" name="bgcolor">
235 <item><ref id="bordercolor" name="bordercolor">
236 <item><ref id="cclear" name="cclear">
237 <item><ref id="cclearxy" name="cclearxy">
238 <item><ref id="cgetc" name="cgetc">
239 <item><ref id="chline" name="chline">
240 <item><ref id="chlinexy" name="chlinexy">
241 <item><ref id="clrscr" name="clrscr">
242 <item><ref id="cprintf" name="cprintf">
243 <item><ref id="cputc" name="cputc">
244 <item><ref id="cputcxy" name="cputcxy">
245 <item><ref id="cputs" name="cputs">
246 <item><ref id="cputsxy" name="cputsxy">
247 <item><ref id="cursor" name="cursor">
248 <item><ref id="cvline" name="cvline">
249 <item><ref id="cvlinexy" name="cvlinexy">
250 <item><ref id="gotox" name="gotox">
251 <item><ref id="gotoxy" name="gotoxy">
252 <item><ref id="gotoy" name="gotoy">
253 <item><ref id="kbhit" name="kbhit">
254 <item><ref id="revers" name="revers">
255 <item><ref id="screensize" name="screensize">
256 <item><ref id="textcolor" name="textcolor">
257 <item><ref id="vcprintf" name="vcprintf">
258 <item><ref id="wherex" name="wherex">
259 <item><ref id="wherey" name="wherey">
263 <sect1><tt/ctype.h/<label id="ctype.h"><p>
266 <item><ref id="isalnum" name="isalnum">
267 <item><ref id="isalpha" name="isalpha">
268 <item><ref id="isascii" name="isascii">
269 <item><ref id="isblank" name="isblank">
270 <item><ref id="iscntrl" name="iscntrl">
271 <item><ref id="isdigit" name="isdigit">
272 <item><ref id="isgraph" name="isgraph">
273 <item><ref id="islower" name="islower">
274 <item><ref id="isprint" name="isprint">
275 <item><ref id="ispunct" name="ispunct">
276 <item><ref id="isspace" name="isspace">
277 <item><ref id="isupper" name="isupper">
278 <item><ref id="isxdigit" name="isxdigit">
279 <item><ref id="tolower" name="tolower">
280 <item><ref id="toupper" name="toupper">
284 <sect1><tt/dbg.h/<label id="dbg.h"><p>
287 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
293 <sect1><tt/dio.h/<label id="dio.h"><p>
295 <url url="dio.html" name="Low-level disk I/O API">.
298 <sect1><tt/dirent.h/<label id="dirent.h"><p>
301 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
302 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
303 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
304 <item><ref id="_DE_ISREG" name="_DE_ISREG">
305 <item><ref id="closedir" name="closedir">
306 <item><ref id="opendir" name="opendir">
307 <item><ref id="readdir" name="readdir">
308 <item><ref id="rewinddir" name="rewinddir">
309 <item><ref id="seekdir" name="seekdir">
310 <item><ref id="telldir" name="telldir">
316 <sect1><tt/em.h/<label id="em.h"><p>
319 <item><ref id="em_commit" name="em_commit">
320 <item><ref id="em_copyfrom" name="em_copyfrom">
321 <item><ref id="em_copyto" name="em_copyto">
322 <item><ref id="em_install" name="em_install">
323 <item><ref id="em_load_driver" name="em_load_driver">
324 <item><ref id="em_map" name="em_map">
325 <item><ref id="em_pagecount" name="em_pagecount">
326 <item><ref id="em_uninstall" name="em_uninstall">
327 <item><ref id="em_unload" name="em_unload">
328 <item><ref id="em_use" name="em_use">
332 <sect1><tt/errno.h/<label id="errno.h"><p>
335 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
336 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
337 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
338 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
344 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
347 <item><ref id="close" name="close">
348 <item><ref id="creat" name="creat">
349 <item><ref id="open" name="open">
353 <sect1><tt/gamate.h/<label id="gamate.h"><p>
356 <!-- <item><ref id="get_tv" name="get_tv"> -->
357 <item><ref id="waitvsync" name="waitvsync">
363 <sect1><tt/geos.h/<label id="geos.h"><p>
368 <sect1><tt/joystick.h/<label id="joystick.h"><p>
371 <item><ref id="joy_count" name="joy_count">
372 <item><ref id="joy_install" name="joy_install">
373 <item><ref id="joy_load_driver" name="joy_load_driver">
374 <item><ref id="joy_read" name="joy_read">
375 <item><ref id="joy_uninstall" name="joy_uninstall">
376 <item><ref id="joy_unload" name="joy_unload">
380 <sect1><tt/locale.h/<label id="locale.h"><p>
383 <item><ref id="localeconv" name="localeconv">
384 <item><ref id="setlocale" name="setlocale">
388 <sect1><tt/lynx.h/<label id="lynx.h"><p>
391 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
392 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
393 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
394 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
395 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
396 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
397 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
403 <sect1><tt/lz4.h/<label id="lz4.h"><p>
406 <item><ref id="decompress_lz4" name="decompress_lz4">
410 <sect1><tt/modload.h/<label id="modload.h"><p>
413 <item><ref id="mod_load" name="mod_load">
414 <item><ref id="mod_free" name="mod_free">
418 <sect1><tt/mouse.h/<label id="mouse.h"><p>
421 <item><ref id="mouse_buttons" name="mouse_buttons">
422 <item><ref id="mouse_getbox" name="mouse_getbox">
423 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
424 <item><ref id="mouse_hide" name="mouse_hide">
425 <item><ref id="mouse_info" name="mouse_info">
426 <item><ref id="mouse_install" name="mouse_install">
427 <item><ref id="mouse_ioctl" name="mouse_ioctl">
428 <item><ref id="mouse_load_driver" name="mouse_load_driver">
429 <item><ref id="mouse_move" name="mouse_move">
430 <item><ref id="mouse_pos" name="mouse_pos">
431 <item><ref id="mouse_setbox" name="mouse_setbox">
432 <item><ref id="mouse_show" name="mouse_show">
433 <item><ref id="mouse_uninstall" name="mouse_uninstall">
434 <item><ref id="mouse_unload" name="mouse_unload">
438 <sect1><tt/nes.h/<label id="nes.h"><p>
441 <!-- <item><ref id="get_tv" name="get_tv"> -->
442 <item><ref id="waitvsync" name="waitvsync">
448 <sect1><tt/o65.h/<label id="o65.h"><p>
450 The <tt/o65.h/ header file contains structure and constant definitions that
451 may be used when dealing with files in <url
452 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
453 It does not declare any functions.
456 <sect1><tt/pce.h/<label id="pce.h"><p>
459 <!-- <item><ref id="get_tv" name="get_tv"> -->
460 <item><ref id="waitvsync" name="waitvsync">
466 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
469 <item><ref id="PEEK" name="PEEK">
470 <item><ref id="PEEKW" name="PEEKW">
471 <item><ref id="POKE" name="POKE">
472 <item><ref id="POKEW" name="POKEW">
476 <sect1><tt/pen.h/<label id="pen.h"><p>
479 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
480 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
486 <sect1><tt/pet.h/<label id="pet.h"><p>
491 <sect1><tt/plus4.h/<label id="plus4.h"><p>
496 <sect1><tt/serial.h/<label id="serial.h"><p>
498 The <tt/serial.h/ header file contains definitions for initializing serial
502 <item><ref id="ser_close" name="ser_close">
503 <item><ref id="ser_get" name="ser_get">
504 <item><ref id="ser_install" name="ser_install">
505 <item><ref id="ser_ioctl" name="ser_ioctl">
506 <item><ref id="ser_load_driver" name="ser_load_driver">
507 <item><ref id="ser_open" name="ser_open">
508 <item><ref id="ser_put" name="ser_put">
509 <item><ref id="ser_status" name="ser_status">
510 <item><ref id="ser_uninstall" name="ser_uninstall">
511 <item><ref id="ser_unload" name="ser_unload">
515 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
518 <item><ref id="setjmp" name="setjmp">
519 <item><ref id="longjmp" name="longjmp">
523 <sect1><tt/signal.h/<label id="signal.h"><p>
526 <item><ref id="raise" name="raise">
527 <item><ref id="signal" name="signal">
531 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
536 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
541 <sect1><tt/stddef.h/<label id="stddef.h"><p>
544 <item><ref id="offsetof" name="offsetof">
548 <sect1><tt/stdio.h/<label id="stdio.h"><p>
551 <item><ref id="_poserror" name="_poserror">
552 <item><ref id="clearerr" name="clearerr">
553 <!-- <item><ref id="fclose" name="fclose"> -->
554 <!-- <item><ref id="fdopen" name="fdopen"> -->
555 <item><ref id="feof" name="feof">
556 <item><ref id="ferror" name="ferror">
557 <!-- <item><ref id="fflush" name="fflush"> -->
558 <!-- <item><ref id="fgetc" name="fgetc"> -->
559 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
560 <!-- <item><ref id="fgets" name="fgets"> -->
561 <item><ref id="fileno" name="fileno">
562 <!-- <item><ref id="fopen" name="fopen"> -->
563 <!-- <item><ref id="fprintf" name="fprintf"> -->
564 <!-- <item><ref id="fputc" name="fputc"> -->
565 <!-- <item><ref id="fputs" name="fputs"> -->
566 <!-- <item><ref id="fread" name="fread"> -->
567 <!-- <item><ref id="freopen" name="freopen"> -->
568 <!-- <item><ref id="fscanf" name="fscanf"> -->
569 <!-- <item><ref id="fseek" name="fseek"> -->
570 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
571 <!-- <item><ref id="ftell" name="ftell"> -->
572 <!-- <item><ref id="fwrite" name="fwrite"> -->
573 <!-- <item><ref id="getc" name="getc"> -->
574 <!-- <item><ref id="getchar" name="getchar"> -->
575 <!-- <item><ref id="gets" name="gets"> -->
576 <!-- <item><ref id="printf" name="printf"> -->
577 <!-- <item><ref id="putc" name="putc"> -->
578 <!-- <item><ref id="putchar" name="putchar"> -->
579 <!-- <item><ref id="puts" name="puts"> -->
580 <item><ref id="rename" name="rename">
581 <item><ref id="remove" name="remove">
582 <!-- <item><ref id="rewind" name="rewind"> -->
583 <!-- <item><ref id="scanf" name="scanf"> -->
584 <!-- <item><ref id="snprintf" name="snprintf"> -->
585 <!-- <item><ref id="sprintf" name="sprintf"> -->
586 <!-- <item><ref id="sscanf" name="sscanf"> -->
587 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
588 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
589 <!-- <item><ref id="vprintf" name="vprintf"> -->
590 <!-- <item><ref id="vscanf" name="vscanf"> -->
591 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
592 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
593 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
599 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
602 <item><ref id="_heapadd" name="_heapadd">
603 <item><ref id="_heapblocksize" name="_heapblocksize">
604 <item><ref id="_heapmaxavail" name="_heapmaxavail">
605 <item><ref id="_heapmemavail" name="_heapmemavail">
606 <item><ref id="_randomize" name="_randomize">
607 <item><ref id="_swap" name="_swap">
608 <item><ref id="abort" name="abort">
609 <item><ref id="abs" name="abs">
610 <item><ref id="atexit" name="atexit">
611 <item><ref id="atoi" name="atoi">
612 <item><ref id="atol" name="atol">
613 <item><ref id="bsearch" name="bsearch">
614 <item><ref id="calloc" name="calloc">
615 <item><ref id="div" name="div">
616 <item><ref id="exit" name="exit">
617 <item><ref id="free" name="free">
618 <item><ref id="getenv" name="getenv">
619 <item><ref id="itoa" name="itoa">
620 <item><ref id="labs" name="labs">
621 <item><ref id="ltoa" name="ltoa">
622 <item><ref id="malloc" name="malloc">
623 <item><ref id="perror" name="perror">
624 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
625 <!-- <item><ref id="putenv" name="putenv"> -->
626 <item><ref id="qsort" name="qsort">
627 <item><ref id="rand" name="rand">
628 <item><ref id="realloc" name="realloc">
629 <item><ref id="srand" name="srand">
630 <!-- <item><ref id="system" name="system"> -->
631 <item><ref id="ultoa" name="ultoa">
632 <item><ref id="utoa" name="utoa">
638 <sect1><tt/string.h/<label id="string.h"><p>
641 <item><ref id="_stroserror" name="_stroserror">
642 <item><ref id="bzero" name="bzero">
643 <item><ref id="memchr" name="memchr">
644 <item><ref id="memcmp" name="memcmp">
645 <item><ref id="memcpy" name="memcpy">
646 <item><ref id="memmove" name="memmove">
647 <item><ref id="memset" name="memset">
648 <item><ref id="strcasecmp" name="strcasecmp">
649 <item><ref id="strcat" name="strcat">
650 <item><ref id="strchr" name="strchr">
651 <item><ref id="strcmp" name="strcmp">
652 <item><ref id="strcoll" name="strcoll">
653 <item><ref id="strcpy" name="strcpy">
654 <item><ref id="strcspn" name="strcspn">
655 <item><ref id="strdup" name="strdup">
656 <item><ref id="strerror" name="strerror">
657 <item><ref id="stricmp" name="stricmp">
658 <item><ref id="strlen" name="strlen">
659 <item><ref id="strlower" name="strlower">
660 <item><ref id="strlwr" name="strlwr">
661 <item><ref id="strncat" name="strncat">
662 <item><ref id="strncmp" name="strncmp">
663 <item><ref id="strncpy" name="strncpy">
664 <item><ref id="strqtok" name="strqtok">
665 <item><ref id="strrchr" name="strrchr">
666 <item><ref id="strspn" name="strspn">
667 <item><ref id="strstr" name="strstr">
668 <item><ref id="strtok" name="strtok">
669 <item><ref id="strxfrm" name="strxfrm">
670 <item><ref id="strupper" name="strupper">
671 <item><ref id="strupr" name="strupr">
677 <sect1><tt/tgi.h/<label id="tgi.h"><p>
680 <item><ref id="tgi_arc" name="tgi_arc">
681 <item><ref id="tgi_bar" name="tgi_bar">
682 <item><ref id="tgi_circle" name="tgi_circle">
683 <item><ref id="tgi_clear" name="tgi_clear">
684 <item><ref id="tgi_done" name="tgi_done">
685 <item><ref id="tgi_ellipse" name="tgi_ellipse">
686 <item><ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
687 <item><ref id="tgi_getaspectratio" name="tgi_getaspectratio">
688 <item><ref id="tgi_getcolor" name="tgi_getcolor">
689 <item><ref id="tgi_getcolorcount" name="tgi_getcolorcount">
690 <item><ref id="tgi_getdefpalette" name="tgi_getdefpalette">
691 <item><ref id="tgi_geterror" name="tgi_geterror">
692 <item><ref id="tgi_geterrormsg" name="tgi_geterrormsg">
693 <item><ref id="tgi_getmaxcolor" name="tgi_getmaxcolor">
694 <item><ref id="tgi_getmaxx" name="tgi_getmaxx">
695 <item><ref id="tgi_getmaxy" name="tgi_getmaxy">
696 <item><ref id="tgi_getpagecount" name="tgi_getpagecount">
697 <item><ref id="tgi_getpalette" name="tgi_getpalette">
698 <item><ref id="tgi_getpixel" name="tgi_getpixel">
699 <item><ref id="tgi_gettextheight" name="tgi_gettextheight">
700 <item><ref id="tgi_gettextwidth" name="tgi_gettextwidth">
701 <item><ref id="tgi_getxres" name="tgi_getxres">
702 <item><ref id="tgi_getyres" name="tgi_getyres">
703 <item><ref id="tgi_gotoxy" name="tgi_gotoxy">
704 <item><ref id="tgi_init" name="tgi_init">
705 <item><ref id="tgi_install" name="tgi_install">
706 <item><ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
707 <item><ref id="tgi_ioctl" name="tgi_ioctl">
708 <item><ref id="tgi_line" name="tgi_line">
709 <item><ref id="tgi_lineto" name="tgi_lineto">
710 <item><ref id="tgi_load_driver" name="tgi_load_driver">
711 <item><ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">
712 <item><ref id="tgi_outtext" name="tgi_outtext">
713 <item><ref id="tgi_outtextxy" name="tgi_outtextxy">
714 <item><ref id="tgi_setaspectratio" name="tgi_setaspectratio">
715 <item><ref id="tgi_setcolor" name="tgi_setcolor">
716 <item><ref id="tgi_setdrawpage" name="tgi_setdrawpage">
717 <item><ref id="tgi_setpalette" name="tgi_setpalette">
718 <item><ref id="tgi_setpixel" name="tgi_setpixel">
719 <item><ref id="tgi_setviewpage" name="tgi_setviewpage">
720 <item><ref id="tgi_settextscale" name="tgi_settextscale">
721 <item><ref id="tgi_settextstyle" name="tgi_settextstyle">
722 <item><ref id="tgi_uninstall" name="tgi_uninstall">
723 <item><ref id="tgi_unload" name="tgi_unload">
726 <sect1><tt/time.h/<label id="time.h"><p>
729 <!-- <item><ref id="_systime" name="_systime"> -->
730 <!-- <item><ref id="asctime" name="asctime"> -->
731 <item><ref id="clock" name="clock">
732 <!-- <item><ref id="ctime" name="ctime"> -->
733 <!-- <item><ref id="gmtime" name="gmtime"> -->
734 <!-- <item><ref id="localtime" name="localtime"> -->
735 <!-- <item><ref id="mktime" name="mktime"> -->
736 <!-- <item><ref id="strftime" name="strftime"> -->
737 <item><ref id="time" name="time">
743 <sect1><tt/unistd.h/<label id="unistd.h"><p>
746 <!-- <item><ref id="chdir" name="chdir"> -->
747 <item><ref id="exec" name="exec">
748 <!-- <item><ref id="getcwd" name="getcwd"> -->
749 <item><ref id="getopt" name="getopt">
750 <!-- <item><ref id="lseek" name="lseek"> -->
751 <!-- <item><ref id="mkdir" name="mkdir"> -->
752 <!-- <item><ref id="read" name="read"> -->
753 <!-- <item><ref id="rmdir" name="rmdir"> -->
754 <item><ref id="sleep" name="sleep">
755 <item><ref id="unlink" name="unlink">
756 <!-- <item><ref id="write" name="write"> -->
762 <sect1><tt/vic20.h/<label id="vic20.h"><p>
767 <sect1><tt/zlib.h/<label id="zlib.h"><p>
770 <!-- <item><ref id="adler32" name="adler32"> -->
771 <!-- <item><ref id="crc32" name="crc32"> -->
772 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
773 <!-- <item><ref id="uncompress" name="uncompress"> -->
779 <sect>Alphabetical function reference<p>
781 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
785 <tag/Function/Determine if a directory entry specifies a directory.
786 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
787 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
788 <tag/Description/The function is called with the type of a directory entry
789 taken from a <tt/struct dirent/ and returns true if the entry designates
792 <item>The function is actually a macro.
794 <tag/Availability/cc65
796 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
797 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
798 <ref id="_DE_ISREG" name="_DE_ISREG">
804 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
808 <tag/Function/Determine if a directory entry specifies a disk label.
809 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
810 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
811 <tag/Description/The function is called with the type of a directory entry
812 taken from a <tt/struct dirent/ and returns true if the entry designates
815 <item>The function is actually a macro.
817 <tag/Availability/cc65
819 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
820 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
821 <ref id="_DE_ISREG" name="_DE_ISREG">
827 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
831 <tag/Function/Determine if a directory entry specifies a link.
832 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
833 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
834 <tag/Description/The function is called with the type of a directory entry
835 taken from a <tt/struct dirent/ and returns true if the entry designates
838 <item>The function is actually a macro.
840 <tag/Availability/cc65
842 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
843 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
844 <ref id="_DE_ISREG" name="_DE_ISREG">
850 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
854 <tag/Function/Determine if a directory entry specifies a regular file.
855 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
856 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
857 <tag/Description/The function is called with the type of a directory entry
858 taken from a <tt/struct dirent/ and returns true if the entry designates
861 <item>The function is actually a macro.
862 <item>A "regular file" means anything with data in it. This might still mean
863 that special processing is needed, when accessing the file. Relative files of
864 the CBM systems are classified as being "regular" files, for example.
866 <tag/Availability/cc65
868 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
869 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
870 <ref id="_DE_ISLNK" name="_DE_ISLNK">
876 <sect1>_heapadd<label id="_heapadd"><p>
880 <tag/Function/Add a block to the heap.
881 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
882 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
883 <tag/Description/The function adds a block of raw memory to the heap.
885 <item>The minimum blocksize that can be added is 6 bytes; the function will
886 ignore smaller blocks.
887 <item>The function is available only as a fastcall function; so, it may be used
888 only in the presence of a prototype.
890 <tag/Availability/cc65
892 <ref id="_heapblocksize" name="_heapblocksize">,
893 <ref id="_heapmaxavail" name="_heapmaxavail">,
894 <ref id="_heapmemavail" name="_heapmemavail">,
895 <ref id="calloc" name="calloc">,
896 <ref id="free" name="free">,
897 <ref id="malloc" name="malloc">,
898 <ref id="realloc" name="realloc">
904 <sect1>_heapblocksize<label id="_heapblocksize"><p>
908 <tag/Function/Return the size of an allocated block.
909 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
910 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
911 <tag/Description/The function returns the size of a block that must have
912 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
913 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
915 <item>Passing a pointer to a block that was is not the result of one of the
916 allocation functions, or that has been free'd will give unpredicable results.
917 <item>The function is available only as a fastcall function; so, it may be used
918 only in the presence of a prototype.
920 <tag/Availability/cc65
922 <ref id="_heapadd" name="_heapadd">,
923 <ref id="_heapmaxavail" name="_heapmaxavail">,
924 <ref id="_heapmemavail" name="_heapmemavail">,
925 <ref id="calloc" name="calloc">,
926 <ref id="free" name="free">,
927 <ref id="malloc" name="malloc">,
928 <ref id="realloc" name="realloc">
934 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
938 <tag/Function/Return the largest block that is available on the heap.
939 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
940 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
941 <tag/Description/The function returns the size of the largest block that may
942 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
943 <tag/Availability/cc65
945 <ref id="_heapadd" name="_heapadd">,
946 <ref id="_heapblocksize" name="_heapblocksize">,
947 <ref id="_heapmemavail" name="_heapmemavail">,
948 <ref id="calloc" name="calloc">,
949 <ref id="free" name="free">,
950 <ref id="malloc" name="malloc">,
951 <ref id="realloc" name="realloc">
957 <sect1>_heapmemavail<label id="_heapmemavail"><p>
961 <tag/Function/Return the total available space on the heap.
962 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
963 <tag/Declaration/<tt/size_t _heapmemavail (void);/
964 <tag/Description/The function returns the total number of bytes available on
967 <item>This function is of less use than usually assumed, since the returned
968 heap space may be available but not in one block. So even if this function
969 says that several times more heap space is available than needed, <ref
970 id="malloc" name="malloc"> may still return <tt/NULL/.
972 <tag/Availability/cc65
974 <ref id="_heapadd" name="_heapadd">,
975 <ref id="_heapblocksize" name="_heapblocksize">,
976 <ref id="_heapmaxavail" name="_heapmaxavail">,
977 <ref id="calloc" name="calloc">,
978 <ref id="free" name="free">,
979 <ref id="malloc" name="malloc">,
980 <ref id="realloc" name="realloc">
986 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
990 <tag/Function/Determines whether the underlying DOS supports command line arguments.
991 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
992 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
993 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
994 It returns 1 if it does.
995 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1000 <sect1>_poserror<label id="_poserror"><p>
1004 <tag/Function/Print an error message for the error in <tt/_oserror/.
1005 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1006 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1007 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1008 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1009 a colon and a blank. Then the error message for the current contents of
1010 <tt/_oserror/ are printed followed by a newline. The message output is the
1011 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1012 argument of <tt/_oserror/.
1013 <tag/Notes/<itemize>
1014 <item>Since operating system specific error code are - you guessed it -
1015 operating system specific, the value in <tt/_oserror/ and the message that is
1016 printed depends on the cc65 target.
1017 <item>The function is only available as fastcall function, so it may only
1018 be used in presence of a prototype.
1020 <tag/Availability/cc65
1022 <ref id="_stroserror" name="_stroserror">,
1023 <ref id="perror" name="perror">
1029 <sect1>_randomize<label id="_randomize"><p>
1033 <tag/Function/Initialize the pseudo random number generator.
1034 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1035 <tag/Declaration/<tt/void _randomize (void);/
1036 <tag/Description/The function initializes the random number generator with
1037 a seed derived from fast changing hardware events, so the seed itself can be
1038 considered random to a certain degree.
1039 <tag/Notes/<itemize>
1040 <item>The randomness of the seed depends on the machine hardware.
1042 <tag/Availability/cc65
1044 <ref id="rand" name="rand">,
1045 <ref id="srand" name="srand">
1051 <sect1>_stroserror<label id="_stroserror"><p>
1055 <tag/Function/Return a string describing an OS specific error code.
1056 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1057 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1058 <tag/Description/<tt/_stroserror/ will return a string describing the given
1059 operating system specific error code.
1060 <tag/Notes/<itemize>
1061 <item>Since operating system specific error code are - you guessed it -
1062 operating system specific, the parameter and the string returned depend on the
1064 <item>The function is only available as fastcall function, so it may only be
1065 used in presence of a prototype.
1067 <tag/Availability/cc65
1069 <ref id="strerror" name="strerror">
1075 <sect1>_swap<label id="_swap"><p>
1079 <tag/Function/Swap the contents of memory areas.
1080 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1081 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1082 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1083 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1084 <tt/size/ bytes in size.
1085 <tag/Notes/<itemize>
1086 <item>The memory areas may not overlap, otherwise the results are undefined.
1087 <item>The function is only available as fastcall function, so it may only be
1088 used in presence of a prototype.
1090 <tag/Availability/cc65
1092 <ref id="memcpy" name="memcpy">,
1093 <ref id="memmove" name="memmove">
1099 <sect1>_sys<label id="_sys"><p>
1103 <tag/Function/Call a subroutine passing register values.
1104 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1105 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1106 <tag/Description/The function will call the subroutine at the address
1107 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1108 registers and the CPU flags are set to the values given in the <tt/regs/
1109 structure. On return from the subroutine, the new values of the registers and
1110 flags are stored back overwriting the old values.
1111 <tag/Notes/<itemize>
1112 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1113 when calling the subroutine (they are unchanged from their current values).
1114 <item>The function is only available as fastcall function, so it may only be
1115 used in presence of a prototype.
1117 <tag/Availability/cc65
1123 <sect1>BRK<label id="BRK"><p>
1127 <tag/Function/Insert a 6502 BRK instrunction into the code.
1128 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1129 <tag/Declaration/<tt/void BRK (void);/
1130 <tag/Description/The function will insert a 6502 BRK instruction into the code
1131 which may be used to trigger a debugger.
1132 <tag/Notes/<itemize>
1133 <item>The function is actually a macro.
1134 <item>The inserted instruction may lead to unexpected results if no debugger
1137 <tag/Availability/cc65
1139 <ref id="CLI" name="CLI">,
1140 <ref id="SEI" name="SEI">
1146 <sect1>CLI<label id="CLI"><p>
1150 <tag/Function/Insert a 6502 CLI instrunction into the code.
1151 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1152 <tag/Declaration/<tt/void CLI (void);/
1153 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1154 so interrupts are enabled. Enabling interrupts has no effects if they are
1155 already enabled (the default).
1156 <tag/Notes/<itemize>
1157 <item>The function is actually a macro.
1158 <item>Disabling interrupts may lead to unexpected results.
1160 <tag/Availability/cc65
1162 <ref id="BRK" name="BRK">,
1163 <ref id="SEI" name="SEI">
1169 <sect1>PEEK<label id="PEEK"><p>
1173 <tag/Function/Read a byte from memory.
1174 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1175 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1176 <tag/Description/The function will read the absolute memory given by <tt/addr/
1177 and return the value read.
1178 <tag/Notes/<itemize>
1179 <item>The function is actually a macro.
1180 <item>This function depends highly on the platform and environment.
1182 <tag/Availability/cc65
1184 <ref id="PEEKW" name="PEEKW">,
1185 <ref id="POKE" name="POKE">
1191 <sect1>PEEKW<label id="PEEKW"><p>
1195 <tag/Function/Read a word (two bytes) from memory.
1196 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1197 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1198 <tag/Description/The function will read the absolute memory given by <tt/addr/
1199 and return the value read. The byte read from the higher address is the high
1200 byte of the return value.
1201 <tag/Notes/<itemize>
1202 <item>The function is actually a macro.
1203 <item>This function depends highly on the platform and environment.
1204 <item>The order in which the two bytes are read is unspecified and may
1205 depend of the address expression used.
1207 <tag/Availability/cc65
1209 <ref id="PEEK" name="PEEK">,
1210 <ref id="POKE" name="POKE">
1216 <sect1>POKE<label id="POKE"><p>
1220 <tag/Function/Write a byte to memory.
1221 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1222 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1223 <tag/Description/The function writes the value <tt/val/ to the absolute
1224 memory address given by <tt/addr/.
1225 <tag/Notes/<itemize>
1226 <item>The function is actually a macro.
1227 <item>This function depends highly on the platform and environment.
1228 <item>Careless use will cause the program to act strange or may crash the
1231 <tag/Availability/cc65
1233 <ref id="PEEK" name="PEEK">,
1234 <ref id="POKEW" name="POKEW">
1240 <sect1>POKEW<label id="POKEW"><p>
1244 <tag/Function/Write a word (two bytes) to memory.
1245 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1246 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1247 <tag/Description/The function writes the value <tt/val/ to the absolute
1248 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1249 the <tt/addr/, the high byte is written to <tt/addr+1/.
1250 <tag/Notes/<itemize>
1251 <item>The function is actually a macro.
1252 <item>This function depends highly on the platform and environment.
1253 <item>Careless use will cause the program to act strange or may crash the
1255 <item>The order in which the two bytes are written is unspecified and may
1256 depend of the address expression used.
1258 <tag/Availability/cc65
1260 <ref id="PEEK" name="PEEK">,
1261 <ref id="POKE" name="POKE">
1267 <sect1>SEI<label id="SEI"><p>
1271 <tag/Function/Insert a 6502 SEI instrunction into the code.
1272 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1273 <tag/Declaration/<tt/void SEI (void);/
1274 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1275 so interrupts are disabled. Note that non maskable interrupts cannot be
1277 <tag/Notes/<itemize>
1278 <item>The function is actually a macro.
1279 <item>Disabling interrupts may lead to unexpected results.
1281 <tag/Availability/cc65
1283 <ref id="BRK" name="BRK">,
1284 <ref id="CLI" name="CLI">
1290 <sect1>abort<label id="abort"><p>
1294 <tag/Function/Terminates a program abnormally.
1295 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1296 <tag/Declaration/<tt/void abort (void);/
1297 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1298 on stderr, then terminates the program with an exit code of 3.
1299 <tag/Availability/ISO 9899
1301 <ref id="assert" name="assert">,
1302 <ref id="exit" name="exit">,
1303 <ref id="raise" name="raise">
1309 <sect1>abs<label id="abs"><p>
1313 <tag/Function/Returns the absolute value of an integer.
1314 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1315 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1316 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1318 <tag/Notes/<itemize>
1319 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1320 <item>The function is only available as fastcall function, so it may only be
1321 used in presence of a prototype.
1323 <tag/Availability/ISO 9899
1325 <ref id="labs" name="labs">
1331 <sect1>assert<label id="assert"><p>
1335 <tag/Function/Test a condition and possibly abort.
1336 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1337 <tag/Declaration/<tt/void assert (int cond);/
1338 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1339 statement. If the condition evaluates t zero (false), assert prints a message
1340 on stderr and aborts the program.
1341 <tag/Notes/<itemize>
1342 <item>The function is actually a macro.
1344 <tag/Availability/ISO 9899
1346 <ref id="abort" name="abort">,
1347 <ref id="exit" name="exit">
1353 <sect1>atexit<label id="atexit"><p>
1357 <tag/Function/Register an exit function.
1358 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1359 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1360 <tag/Description/<tt/atexit/ registers the function pointed to by
1361 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1362 terminates, they are called in LIFO order (the last function registered is
1363 called first). <tt/atexit/ returns zero on success and a nonzero value on
1365 <tag/Notes/<itemize>
1366 <item>A maximum of 5 exit functions can be registered.
1367 <item>There is no way to unregister an exit function.
1368 <item>The function is only available as fastcall function, so it may only be
1369 used in presence of a prototype.
1371 <tag/Availability/ISO 9899
1373 <ref id="abort" name="abort">,
1374 <ref id="exit" name="exit">
1380 <sect1>atmos_load<label id="atmos_load"><p>
1384 <tag/Function/Load Atmos tape.
1385 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1386 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1387 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1388 <tag/Notes/<itemize>
1389 <item>The function is available only as a fastcall function; so, it may be used
1390 only in the presence of a prototype.
1392 <tag/Availability/cc65
1394 <ref id="atmos_save" name="atmos_save">
1400 <sect1>atmos_save<label id="atmos_save"><p>
1404 <tag/Function/Save Atmos tape.
1405 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1406 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1407 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1408 <tag/Notes/<itemize>
1409 <item>The function is available only as a fastcall function; so, it may be used
1410 only in the presence of a prototype.
1412 <tag/Availability/cc65
1414 <ref id="atmos_load" name="atmos_load">
1416 atmos_save("hires", 0xa000, 0xc000);
1422 <sect1>atoi<label id="atoi"><p>
1426 <tag/Function/Convert a string to an integer.
1427 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1428 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1429 <tag/Description/<tt/atoi/ converts the given string into an integer.
1430 Conversion stops as soon as any invalid character is encountered.
1431 <tag/Notes/<itemize>
1432 <item>There is no way to detect any conversion errors.
1433 <item>The function does not check for an numerical overflow when converting.
1434 <item>The function is only available as fastcall function, so it may only be
1435 used in presence of a prototype.
1437 <tag/Availability/ISO 9899
1439 <ref id="atol" name="atol">,
1440 <ref id="itoa" name="itoa">,
1441 <ref id="ltoa" name="ltoa">,
1442 <ref id="ultoa" name="ultoa">,
1443 <ref id="utoa" name="utoa">
1449 <sect1>atol<label id="atol"><p>
1453 <tag/Function/Convert a string to a long integer.
1454 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1455 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1456 <tag/Description/<tt/atol/ converts the given string into a long integer.
1457 Conversion stops as soon as any invalid character is encountered.
1458 <tag/Notes/<itemize>
1459 <item>There is no way to detect any conversion errors.
1460 <item>The function does not check for an numerical overflow when converting.
1461 <item>The function is only available as fastcall function, so it may only be
1462 used in presence of a prototype.
1464 <tag/Availability/ISO 9899
1466 <ref id="atoi" name="atoi">,
1467 <ref id="itoa" name="itoa">,
1468 <ref id="ltoa" name="ltoa">,
1469 <ref id="ultoa" name="ultoa">,
1470 <ref id="utoa" name="utoa">
1476 <sect1>bgcolor<label id="bgcolor"><p>
1480 <tag/Function/Set the background text color.
1481 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1482 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1483 <tag/Description/The function will set a new background color and return the
1484 old (current) one. The background color is valid for the whole text output
1485 area of the screen, not just for new text.
1486 <tag/Notes/<itemize>
1487 <item>Background colors are system dependent. The function may have no effect
1488 on systems where the background color cannot be changed.
1489 <item>The function is only available as fastcall function, so it may only be
1490 used in presence of a prototype.
1492 <tag/Availability/cc65
1494 <ref id="bordercolor" name="bordercolor">,
1495 <ref id="textcolor" name="textcolor">
1501 <sect1>bordercolor<label id="bordercolor"><p>
1505 <tag/Function/Set the border (frame) color.
1506 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1507 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1508 <tag/Description/The function will set a new border color. It returns the old
1509 (current) border color.
1510 <tag/Notes/<itemize>
1511 <item>Border colors are system dependent. The function may have no effect
1512 on systems where the border color cannot be changed.
1513 <item>The function is only available as fastcall function, so it may only
1514 be used in presence of a prototype.
1516 <tag/Availability/cc65
1518 <ref id="bgcolor" name="bgcolor">,
1519 <ref id="textcolor" name="textcolor">
1525 <sect1>bsearch<label id="bsearch"><p>
1529 <tag/Function/Do a binary search in a sorted array.
1530 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1531 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1532 const void* base, size_t n, size_t size,
1533 int __fastcall__ (* cmp) (const void*, const void*));/
1534 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1535 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1536 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1537 the function used to compare the members against the key. The function returns
1538 a pointer to the member found, or <tt/NULL/ if there was no match.
1539 <tag/Notes/<itemize>
1540 <item>The contents of the array must be sorted in ascending order according to
1541 the compare function given.
1542 <item>If there are multiple members that match the key, the function will
1543 return one of the members.
1544 <item>The function is only available as fastcall function, so it may only
1545 be used in presence of a prototype.
1546 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1549 <tag/Availability/ISO 9899
1551 <ref id="qsort" name="qsort">
1557 <sect1>bzero<label id="bzero"><p>
1561 <tag/Function/Fill a memory area with zeroes.
1562 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1563 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1564 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1566 <tag/Notes/<itemize>
1567 <item>The function is non standard and therefore only available in non ANSI
1568 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1569 <item>The function is only available as fastcall function, so it may only
1570 be used in presence of a prototype.
1572 <tag/Availability/cc65
1574 <ref id="_swap" name="_swap">,
1575 <ref id="memcpy" name="memcpy">,
1576 <ref id="memmove" name="memmove">,
1577 <ref id="memset" name="memset">,
1583 <sect1>c64mode<label id="c64mode"><p>
1587 <tag/Function/Switch the C128 into C64 compatible mode.
1588 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1589 <tag/Declaration/<tt/void c64mode (void);/
1590 <tag/Description/The function will cause the machine to reboot into C64 mode.
1591 <tag/Notes/<itemize>
1592 <item>The function is specific to the C128.
1593 <item>The function will not return to the caller.
1595 <tag/Availability/C128
1601 <sect1>calloc<label id="calloc"><p>
1605 <tag/Function/Allocate and clear memory.
1606 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1607 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1608 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1609 of size <tt/size/, clears the whole block with binary zeroes and returns a
1610 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1612 <tag/Notes/<itemize>
1613 <item>Clearing the memory may not have the expected effect on all platforms:
1614 pointers in the block may not be <tt/NULL/ and floating point variables may
1615 not be zero (0.0). In other words: The "clearing" effect of this function
1616 should be used with care for portable programs.
1617 <item>The function is only available as fastcall function, so it may only
1618 be used in presence of a prototype.
1620 <tag/Availability/ISO 9899
1622 <ref id="_heapadd" name="_heapadd">,
1623 <ref id="_heapblocksize" name="_heapblocksize">,
1624 <ref id="_heapmaxavail" name="_heapmaxavail">,
1625 <ref id="_heapmemavail" name="_heapmemavail">,
1626 <ref id="free" name="free">,
1627 <ref id="malloc" name="malloc">,
1628 <ref id="realloc" name="realloc">
1634 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1638 <tag/Function/Input byte from serial bus
1639 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1640 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1641 <tag/Description/The function returns a byte of data, which it
1642 gets from the current TALKer on the serial bus.
1643 In order to receive the data, the device must have previously been
1644 sent a command to TALK and a secondary address if it needs one.
1645 <tag/Notes/<itemize>
1648 <tag/Availability/cc65
1650 <ref id="cbm_k_talk" name="cbm_k_talk">,
1656 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1660 <tag/Function/Input a Character from the Current Device
1661 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1662 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1663 <tag/Description/The function returns a character from the current input device.
1664 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1665 When this function is called, the next byte of data available from the device is returned.
1666 Exception is the routine for the keyboard device (which is the default input device).
1667 <tag/Notes/<itemize>
1670 <tag/Availability/cc65
1672 <ref id="cbm_k_open" name="cbm_k_open">,
1673 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1679 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1683 <tag/Function/Output a byte
1684 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1685 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1686 <tag/Description/Function sends the character to the current output device.
1687 Unless a device has been OPENed and designated as the
1688 current output channel using the CHKOUT routine, the character is
1689 printed to the screen, which is the default output device. If the
1690 cassette is the current device, outputting a byte will only add it to
1691 the buffer. No actual transmission of data will occur until the
1692 192-byte buffer is full.
1693 <tag/Notes/<itemize>
1694 <item>The function is only available as fastcall function, so it may
1695 only be used in presence of a prototype.
1697 <tag/Availability/cc65
1699 <ref id="cbm_k_open" name="cbm_k_open">,
1700 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1706 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1710 <tag/Function/Designate a Logical File As the Current Input Channel
1711 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1712 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1713 <tag/Description/If you wish to
1714 get data from any device other than the keyboard, this function must be
1715 called after OPENing the device, before you can get a data byte with
1716 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1717 the logical file whose file number was supplied as the
1718 current file, its device as the current device, and its secondary
1719 address as the current secondary address. If the device on the
1720 channel is a serial device, which requires a TALK command and
1721 sometimes a secondary address, function will send them over the
1723 <tag/Notes/<itemize>
1724 <item>The function is only available as fastcall function, so it may
1725 only be used in presence of a prototype.
1727 <tag/Availability/cc65
1729 <ref id="cbm_k_open" name="cbm_k_open">,
1730 <ref id="cbm_k_basin" name="cbm_k_basin">,
1731 <ref id="cbm_k_getin" name="cbm_k_getin">
1737 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1741 <tag/Function/Transmit a byte over the serial bus
1742 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1743 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1744 <tag/Description/Purpose of this function is to send a byte of data over
1745 the serial bus. In order for the data to be received, the serial
1746 device must have first been commanded to LISTEN and been given a
1747 secondary address if necessary. This routine always buffers the
1748 current character, and defers sending it until the next byte is
1749 buffered. When the UNLISTEN command is sent, the last byte will be
1750 sent with an End or Identify (EOI).
1751 <tag/Notes/<itemize>
1752 <item>The function is only available as fastcall function, so it may
1753 only be used in presence of a prototype.
1755 <tag/Availability/cc65
1757 <ref id="cbm_k_listen" name="cbm_k_listen">,
1758 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1764 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1768 <tag/Function/Designate a Logical File As the Current Output Channel
1769 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1770 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1771 <tag/Description/If you wish to
1772 output data to any device other than the screen, this routine must be
1773 called after OPENing the device, and before you output a data byte
1774 with the cbm_k_bsout() function. When called, the function will designate the
1775 logical file whose file number was supplied as the current
1776 file, its device as the current device, and its secondary address as
1777 the current secondary address. If the device on the channel uses the
1778 serial bus, and therefore requires a LISTEN command and possibly a
1779 secondary address, this information will be sent on the bus.
1780 <tag/Notes/<itemize>
1781 <item>The function is only available as fastcall function, so it may
1782 only be used in presence of a prototype.
1784 <tag/Availability/cc65
1786 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1787 <ref id="cbm_k_listen" name="cbm_k_listen">
1793 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1797 <tag/Function/Close All Logical I/O Files
1798 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1799 <tag/Declaration/<tt/void cbm_k_clall (void);/
1800 <tag/Description/It closes all
1801 open files, by resetting the index into open files to
1802 zero and restores the default I/O devices.
1803 <tag/Notes/<itemize>
1806 <tag/Availability/cc65
1808 <ref id="cbm_k_open" name="cbm_k_open">,
1809 <ref id="cbm_k_close" name="cbm_k_close">
1815 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1819 <tag/Function/Close a Logical I/O File
1820 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1821 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1822 <tag/Description/It is used to
1823 close a logical file after all I/O operations involving that file have
1825 <tag/Notes/<itemize>
1826 <item>The function is only available as fastcall function, so it may
1827 only be used in presence of a prototype.
1829 <tag/Availability/cc65
1831 <ref id="cbm_k_open" name="cbm_k_open">,
1832 <ref id="cbm_k_clall" name="cbm_k_clall">
1838 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1842 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1843 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1844 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1845 <tag/Description/It sets the
1846 current input device to the keyboard, and the current output device to
1847 the screen. Also, if the current input device was formerly a serial
1848 device, the routine sends it an UNTALK command on the serial bus, and
1849 if a serial device was formerly the current output device, the routine
1850 sends it an UNLISTEN command.
1851 <tag/Notes/<itemize>
1854 <tag/Availability/cc65
1856 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
1857 <ref id="cbm_k_ckout" name="cbm_k_ckout">
1863 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
1867 <tag/Function/Get One Byte from the Input Device
1868 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1869 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
1870 <tag/Description/Function gets a character from the current input device.
1871 <tag/Notes/<itemize>
1874 <tag/Availability/cc65
1876 <ref id="cbm_k_basin" name="cbm_k_basin">
1882 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
1886 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
1887 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1888 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
1889 <tag/Description/This function returns the address of
1890 the memory section where the memory mapped I/O devices are located. This
1891 address can then be used with an offset to access the memory mapped I/O
1892 devices in the Commodore 64. The offset is the number of locations from
1893 the beginning of the page on which the I/O register you want is located.
1894 This function exists to provide compatibility between the Commodore 64,
1895 VIC-20, and future models of the Commodore 64. If the I/O locations for
1896 a program are set by a call to this function, they should
1897 still remain compatible with future versions of the Commodore 64, the
1899 <tag/Notes/<itemize>
1902 <tag/Availability/cc65
1910 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
1914 <tag/Function/Command a device on the serial bus to LISTEN
1915 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1916 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
1917 <tag/Description/This function will command a device on the serial bus to
1918 receive data. The KERNAL routine will OR the supplied device number bit by bit
1919 to convert it to a listen address, then transmits this data as a command on
1920 the serial bus. The specified device will then go into listen mode, and
1921 be ready to accept information.
1922 <tag/Notes/<itemize>
1923 <item>The function is only available as fastcall function, so it may
1924 only be used in presence of a prototype.
1926 <tag/Availability/cc65
1928 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
1934 <sect1>cbm_k_load<label id="cbm_k_load"><p>
1938 <tag/Function/Load RAM from a Device
1939 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1940 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
1941 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
1942 It can also be used for a verify operation, comparing data from a device with the data already in
1943 memory, while leaving the data stored in RAM unchanged.
1944 The flag must be set to 0 for a LOAD operation, or 1 for a
1945 verify, If the input device is OPENed with a secondary address (SA) of 0
1946 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
1947 If the device is addressed with a secondary address of 1, then the data is
1948 loaded into memory starting at the location specified by the header.
1949 Function returns the address of the highest RAM location loaded.
1950 Before this function can be called, the KERNAL SETLFS, and SETNAM
1951 routines must be called.
1952 <tag/Notes/<itemize>
1953 <item>The function is only available as fastcall function, so it may
1954 only be used in presence of a prototype.
1956 <tag/Availability/cc65
1958 <ref id="cbm_k_save" name="cbm_k_save">,
1959 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1960 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1966 <sect1>cbm_k_open<label id="cbm_k_open"><p>
1970 <tag/Function/Open a Logical I/O File
1971 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1972 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
1973 <tag/Description/This function assigns a logical file to a device, so that it can be used for
1974 Input/Output operations. In order to specify the logical file number,
1975 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
1976 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
1977 functions are called, cbm_k_open() is then called.
1978 <tag/Notes/<itemize>
1981 <tag/Availability/cc65
1983 <ref id="cbm_k_close" name="cbm_k_close">,
1984 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1985 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1991 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
1995 <tag/Function/Read status word
1996 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1997 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
1998 <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.
1999 <tag/Notes/<itemize>
2002 <tag/Availability/cc65
2010 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2014 <tag/Function/Save RAM to a Device
2015 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2016 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2017 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2018 used before calling this function. However, a file name is not required to
2019 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2020 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.
2021 <tag/Notes/<itemize>
2022 <item>The function is only available as fastcall function, so it may
2023 only be used in presence of a prototype.
2025 <tag/Availability/cc65
2027 <ref id="cbm_k_load" name="cbm_k_load">,
2028 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2029 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2035 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2039 <tag/Function/Scan the keyboard matrix.
2040 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2041 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2042 <tag/Description/This function looks at the switches in the keyboard, to see
2043 if any of them are being pressed. If they are, then code numbers for them are
2044 stored in RAM. Other functions use those numbers to input text. Normally,
2045 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2046 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2047 function, in order to provide input from the keyboard.
2048 <tag/Availability/cc65
2050 <ref id="cbm_k_getin" name="cbm_k_getin">,
2051 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2052 <ref id="cgetc" name="cgetc">,
2053 <!-- <ref id="getc" name="getc"> -->
2054 <!-- <ref id="getchar" name="getchar"> -->
2060 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2064 <tag/Function/Set up a logical file
2065 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2066 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2067 <tag/Description/This functions sets up the logical file by setting its number, device address,
2068 and secondary address.
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_setnam" name="cbm_k_setnam">
2081 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2085 <tag/Function/Set Filename Parameters
2086 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2087 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2088 <tag/Description/This function is used to set up the file name for the OPEN,
2089 SAVE, or LOAD operations.
2090 <tag/Notes/<itemize>
2091 <item>The function is only available as fastcall function, so it may
2092 only be used in presence of a prototype.
2094 <tag/Availability/cc65
2096 <ref id="cbm_k_open" name="cbm_k_open">,
2097 <ref id="cbm_k_load" name="cbm_k_load">,
2098 <ref id="cbm_k_save" name="cbm_k_save">
2104 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2108 <tag/Function/Commands device to TALK
2109 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2110 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2111 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2112 bus. This commands the device to TALK.
2113 <tag/Notes/<itemize>
2114 <item>The function is only available as fastcall function, so it may
2115 only be used in presence of a prototype.
2117 <tag/Availability/cc65
2119 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2125 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2129 <tag/Function/Update the Jiffy clock.
2130 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2131 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2132 <tag/Description/This function adds one count to the Jiffy clock. That clock
2133 counts sixtieths of a second. It is used by the library's <tt/clock()/
2134 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2135 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2136 then that ISR must call this function, in order to keep the clock valid.
2137 <tag/Availability/cc65
2139 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2140 <ref id="clock" name="clock">
2146 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2150 <tag/Function/Send an UNLISTEN command
2151 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2152 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2153 <tag/Description/This function commands all devices on the serial bus to
2154 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2155 function results in an UNLISTEN command being transmitted on the serial
2156 bus. Only devices previously commanded to LISTEN are affected. This
2157 function is normally used after the host computer is finished sending data
2158 to external devices. Sending the UNLISTEN commands the listening devices
2159 to get off the serial bus so it can be used for other purposes.
2160 <tag/Notes/<itemize>
2163 <tag/Availability/cc65
2165 <ref id="cbm_k_listen" name="cbm_k_listen">
2171 <sect1>cclear<label id="cclear"><p>
2175 <tag/Function/Clear part of a line (write a given number of spaces).
2176 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2177 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2178 <tag/Description/The function clears part of a line by writing <tt/length/
2179 spaces in the current text color.
2180 <tag/Notes/<itemize>
2181 <item>The function is only available as fastcall function, so it may
2182 only be used in presence of a prototype.
2184 <tag/Availability/cc65
2186 <ref id="cclearxy" name="cclearxy">,
2187 <ref id="clrscr" name="clrscr">
2193 <sect1>cclearxy<label id="cclearxy"><p>
2197 <tag/Function/Clear part of a line (write a given number of spaces) starting
2198 at a specific screen position.
2199 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2200 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2201 <tag/Description/The function moves the cursor to a specific position, and
2202 will then clear part of the line by writing <tt/length/ spaces in the current
2204 <tag/Notes/<itemize>
2205 <item>The function is only available as fastcall function, so it may
2206 only be used in presence of a prototype.
2208 <tag/Availability/cc65
2210 <ref id="cclear" name="cclear">,
2211 <ref id="clrscr" name="clrscr">
2217 <sect1>cgetc<label id="cgetc"><p>
2221 <tag/Function/Read a character from the keyboard.
2222 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2223 <tag/Declaration/<tt/char cgetc (void);/
2224 <tag/Description/The function reads a character from the keyboard. If there is
2225 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2226 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2227 displayed while waiting.
2228 <tag/Notes/<itemize>
2229 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2230 from that buffer; and, wait only if the buffer is empty.
2231 <item>The keyboard must be scanned periodically, in order for this function to
2232 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2234 <tag/Availability/cc65
2236 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2237 <ref id="cursor" name="cursor">,
2238 <ref id="kbhit" name="kbhit">
2244 <sect1>chline<label id="chline"><p>
2248 <tag/Function/Output a horizontal line in text mode.
2249 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2250 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2251 <tag/Description/The function outputs a horizontal line with the given length
2252 starting at the current cursor position.
2253 <tag/Notes/<itemize>
2254 <item>The character used to draw the horizontal line is system dependent.
2255 If available, a line drawing character is used. Drawing a line that is partially
2256 off screen leads to undefined behaviour.
2257 <item>The function is only available as fastcall function, so it may only be
2258 used in presence of a prototype.
2260 <tag/Availability/cc65
2262 <ref id="chlinexy" name="chlinexy">,
2263 <ref id="cvline" name="cvline">,
2264 <ref id="cvlinexy" name="cvlinexy">
2270 <sect1>chlinexy<label id="chlinexy"><p>
2274 <tag/Function/Output a horizontal line at a given position in text mode.
2275 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2276 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2277 <tag/Description/The function outputs a horizontal line with the given length
2278 starting at a given position.
2279 <tag/Notes/<itemize>
2280 <item>The character used to draw the horizontal line is system dependent.
2281 If available, a line drawing character is used. Drawing a line that is partially
2282 off screen leads to undefined behaviour.
2283 <item>The function is only available as fastcall function, so it may only be
2284 used in presence of a prototype.
2286 <tag/Availability/cc65
2288 <ref id="chline" name="chline">,
2289 <ref id="cvline" name="cvline">,
2290 <ref id="cvlinexy" name="cvlinexy">
2296 <sect1>clearerr<label id="clearerr"><p>
2300 <tag/Function/Clear error and end-of-file status of a stream.
2301 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2302 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2303 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2304 indicators for the stream <tt/f/.
2305 <tag/Notes/<itemize>
2306 <item>The function is only available as fastcall function, so it may only be
2307 used in presence of a prototype.
2309 <tag/Availability/ISO 9899
2311 <ref id="feof" name="feof">,
2312 <ref id="ferror" name="ferror">
2318 <sect1>clock<label id="clock"><p>
2322 <tag/Function/Determine the processor time used.
2323 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2324 <tag/Declaration/<tt/clock_t clock (void);/
2325 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2326 time used by the program. The time is returned in implementation-defined
2327 units. It can be converted to seconds by dividing by the value of the macro
2328 <tt/CLOCKS_PER_SEC/.
2329 <tag/Notes/<itemize>
2330 <item>Since the machines that cc65-generated programs run on cannot run multiple
2331 processes, the function actually will return the time since some
2332 implementation-defined point in the past.
2333 <item>The Jiffy clock must be "running", in order for this function to return
2334 changing values. (See the description of <tt/cbm_k_udtim()/.)
2336 <tag/Availability/ISO 9899
2338 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2339 <ref id="time" name="time">
2345 <sect1>clrscr<label id="clrscr"><p>
2349 <tag/Function/Clear the text screen.
2350 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2351 <tag/Declaration/<tt/void clrscr (void);/
2352 <tag/Description/The function clears the text screen and moves the cursor to
2353 the upper left corner.
2354 <tag/Availability/cc65
2356 <ref id="cclear" name="cclear">,
2357 <ref id="cclearxy" name="cclearxy">
2363 <sect1>close<label id="close"><p>
2367 <tag/Function/Close a file descriptor.
2368 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2369 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2370 <tag/Description/The function closes the given file descriptor. It returns zero
2371 on success and -1 on error. If an error occurs, the cause can be determined by
2372 reading the <tt/errno/ variable.
2373 <tag/Notes/<itemize>
2374 <item>The function is only available as fastcall function, so it may only
2375 be used in presence of a prototype.
2377 <tag/Availability/POSIX 1003.1
2379 <ref id="creat" name="creat">,
2380 <ref id="open" name="open">
2386 <sect1>closedir<label id="closedir"><p>
2390 <tag/Function/Close a directory.
2391 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2392 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2393 <tag/Description/The function closes the given directory descriptor. It returns
2394 zero on success and -1 on error. If an error occurs, the cause can be determined
2395 by reading the <tt/errno/ variable.
2396 <tag/Notes/<itemize>
2397 <item>The function is only available as fastcall function, so it may only
2398 be used in presence of a prototype.
2400 <tag/Availability/POSIX 1003.1
2402 <ref id="opendir" name="opendir">,
2403 <ref id="readdir" name="readdir">
2409 <sect1>creat<label id="creat"><p>
2413 <tag/Function/Create a file.
2414 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2415 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2416 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2417 associated with it. On error, -1 is returned and an error code is stored in
2419 <tag/Notes/<itemize>
2420 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2421 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2422 <item>The function is only available as fastcall function, so it may only
2423 be used in presence of a prototype.
2425 <tag/Availability/POSIX 1003.1
2427 <ref id="close" name="close">,
2428 <ref id="open" name="open">
2434 <sect1>cprintf<label id="cprintf"><p>
2438 <tag/Function/Formatted output to the console.
2439 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2440 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2441 <tag/Description/The arguments are converted to text where necessary and
2442 formatted according to the format string given. The resulting string is output
2443 to the console. <tt/cprintf/ supports the same format specifiers as
2444 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2445 <tag/Notes/<itemize>
2446 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2447 between <tt/\r/ and <tt/\n/.
2449 <tag/Availability/cc65
2451 <ref id="cputc" name="cputc">,
2452 <ref id="cputcxy" name="cputcxy">,
2453 <ref id="cputs" name="cputs">,
2454 <ref id="cputsxy" name="cputsxy">,
2455 <ref id="vcprintf" name="vcprintf">
2461 <sect1>cputc<label id="cputc"><p>
2465 <tag/Function/Output a character directly to the console.
2466 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2467 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2468 <tag/Description/Output one character to the console at the current cursor
2470 <tag/Notes/<itemize>
2471 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2472 between <tt/\r/ and <tt/\n/.
2473 <item>The function is only available as fastcall function, so it may only
2474 be used in presence of a prototype.
2476 <tag/Availability/cc65
2478 <ref id="cprintf" name="cprintf">,
2479 <ref id="cputcxy" name="cputcxy">,
2480 <ref id="cputs" name="cputs">,
2481 <ref id="cputsxy" name="cputsxy">,
2482 <ref id="vcprintf" name="vcprintf">
2488 <sect1>cputcxy<label id="cputcxy"><p>
2492 <tag/Function/Output a character at a specific screen position.
2493 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2494 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2495 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2496 the screen and outputs one character.
2497 <tag/Notes/<itemize>
2498 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2499 between <tt/\r/ and <tt/\n/.
2500 <item>The function is only available as fastcall function, so it may only
2501 be used in presence of a prototype.
2503 <tag/Availability/cc65
2505 <ref id="cprintf" name="cprintf">,
2506 <ref id="cputc" name="cputc">,
2507 <ref id="cputs" name="cputs">,
2508 <ref id="cputsxy" name="cputsxy">,
2509 <ref id="vcprintf" name="vcprintf">
2515 <sect1>cputs<label id="cputs"><p>
2519 <tag/Function/Output a string directly to the console.
2520 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2521 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2522 <tag/Description/The function outputs the given string on the console at the
2523 current cursor position.
2524 <tag/Notes/<itemize>
2525 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2526 between <tt/\r/ and <tt/\n/.
2527 <item>The function is only available as fastcall function, so it may only
2528 be used in presence of a prototype.
2530 <tag/Availability/cc65
2532 <ref id="cprintf" name="cprintf">,
2533 <ref id="cputc" name="cputc">,
2534 <ref id="cputcxy" name="cputcxy">,
2535 <ref id="cputsxy" name="cputsxy">,
2536 <ref id="vcprintf" name="vcprintf">
2542 <sect1>cputsxy<label id="cputsxy"><p>
2546 <tag/Function/Output a string to the console at a given position.
2547 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2548 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2549 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2550 and outputs the string <tt/s/.
2551 <tag/Notes/<itemize>
2552 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2553 between <tt/\r/ and <tt/\n/.
2554 <item>The function is only available as fastcall function, so it may only
2555 be used in presence of a prototype.
2557 <tag/Availability/cc65
2559 <ref id="cprintf" name="cprintf">,
2560 <ref id="cputc" name="cputc">,
2561 <ref id="cputcxy" name="cputcxy">,
2562 <ref id="cputs" name="cputs">,
2563 <ref id="vcprintf" name="vcprintf">
2569 <sect1>cursor<label id="cursor"><p>
2573 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2574 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2575 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2576 <tag/Description/If the argument to the function is non zero, a blinking cursor
2577 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2578 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2579 <tag/Notes/<itemize>
2580 <item>The function is only available as fastcall function, so it may only
2581 be used in presence of a prototype.
2583 <tag/Availability/cc65
2585 <ref id="cgetc" name="cgetc">,
2586 <ref id="kbhit" name="kbhit">
2592 <sect1>cvline<label id="cvline"><p>
2596 <tag/Function/Output a vertical line in text mode.
2597 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2598 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2599 <tag/Description/The function outputs a vertical line with the given length
2600 starting at the current cursor position.
2601 <tag/Notes/<itemize>
2602 <item>The character used to draw the vertical line is system dependent.
2603 If available, a line drawing character is used. Drawing a line that is partially
2604 off screen leads to undefined behaviour.
2605 <item>The function is only available as fastcall function, so it may only be
2606 used in presence of a prototype.
2608 <tag/Availability/cc65
2610 <ref id="chline" name="chline">,
2611 <ref id="chlinexy" name="chlinexy">,
2612 <ref id="cvlinexy" name="cvlinexy">
2618 <sect1>cvlinexy<label id="cvlinexy"><p>
2622 <tag/Function/Output a vertical line at a given position in text mode.
2623 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2624 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2625 <tag/Description/The function outputs a vertical line with the given length
2626 starting at a given position.
2627 <tag/Notes/<itemize>
2628 <item>The character used to draw the vertical line is system dependent.
2629 If available, a line drawing character is used. Drawing a line that is partially
2630 off screen leads to undefined behaviour.
2631 <item>The function is only available as fastcall function, so it may only be
2632 used in presence of a prototype.
2634 <tag/Availability/cc65
2636 <ref id="chline" name="chline">,
2637 <ref id="chlinexy" name="chlinexy">,
2638 <ref id="cvline" name="cvline">
2644 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2648 <tag/Function/Uncompress a LZ4-compressed buffer.
2649 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2650 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2651 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2652 <tag/Notes/<itemize>
2653 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2655 <tag/Availability/cc65
2661 <sect1>div<label id="div"><p>
2665 <tag/Function/Divide two ints and return quotient and remainder.
2666 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2667 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2668 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2669 quotient and remainder in a <tt/div_t/ structure.
2670 <tag/Notes/<itemize>
2671 <item>The function is only available as fastcall function, so it may only
2672 be used in presence of a prototype.
2674 <tag/Availability/ISO 9899
2682 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
2686 <tag/Function/Determines whether the screen is going to be cleared after program exit.
2687 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
2688 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
2689 <tag/Description/The function returns zero if the screen won't be cleared immediately after
2690 program termination. It returns a non-zero value if it will.
2691 <tag/Notes/<itemize>
2692 <item>Some systems, maybe depending on configuration, immediately clear the screen
2693 after a program exits. Therefore it might be difficult to read
2694 the last messages printed by the program prior to its exit. This function can be used
2695 to decide if a delay or wait for a key press should be executed when then program
2698 <tag/Availability/cc65
2706 printf("Hello World\n");
2707 if (doesclrscrafterexit())
2716 <sect1>em_commit<label id="em_commit"><p>
2720 <tag/Function/Commit changes into extended memory.
2721 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2722 <tag/Declaration/<tt/void em_commit (void);/
2723 <tag/Description/Commit changes in the memory window to extended storage. If
2724 the contents of the memory window have been changed, these changes may be lost
2725 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
2726 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
2727 name="em_copyto">/ are called without calling <tt/em_commit/ first.
2728 <tag/Notes/<itemize>
2729 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
2730 memory window are discarded, it does just mean that the drivers is allowed
2732 <item>The function is only available as fastcall function, so it may only be
2733 used in presence of a prototype.
2734 <item>The function produces undefined results if no extended memory driver is
2737 <tag/Availability/cc65
2739 <ref id="em_load_driver" name="em_load_driver">,
2740 <ref id="em_map" name="em_map">,
2741 <ref id="em_use" name="em_use">
2747 <sect1>em_copyfrom<label id="em_copyfrom"><p>
2751 <tag/Function/Copy from extended into normal memory.
2752 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2753 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
2754 <tag/Description/Copy data from extended memory into linear memory. Source and
2755 target addresses as well as the number of bytes to transfer are specified in
2756 the <tt/em_copy/ structure that is passed as a parameter.
2757 <tag/Notes/<itemize>
2758 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
2759 made any changes to the data in the window, call <tt/<ref id="em_commit"
2760 name="em_commit">/ first, or the changes are lost.
2761 <item>The function is only available as fastcall function, so it may only be
2762 used in presence of a prototype.
2763 <item>The function produces undefined results if no extended memory driver is
2766 <tag/Availability/cc65
2768 <ref id="em_commit" name="em_commit">,
2769 <ref id="em_copyto" name="em_copyto">,
2770 <ref id="em_load_driver" name="em_load_driver">
2776 <sect1>em_copyto<label id="em_copyto"><p>
2780 <tag/Function/Copy from normal into extended memory.
2781 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2782 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
2783 <tag/Description/Copy data from linear into extended memory. Source and
2784 target addresses as well as the number of bytes to transfer are specified in
2785 the <tt/em_copy/ structure that is passed as a parameter.
2786 <tag/Notes/<itemize>
2787 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
2788 made any changes to the data in the window, call <tt/<ref id="em_commit"
2789 name="em_commit">/ first, or the changes are lost.
2790 <item>The function is only available as fastcall function, so it may only be
2791 used in presence of a prototype.
2792 <item>The function produces undefined results if no extended memory driver is
2795 <tag/Availability/cc65
2797 <ref id="em_commit" name="em_commit">,
2798 <ref id="em_copyfrom" name="em_copyfrom">,
2799 <ref id="em_load_driver" name="em_load_driver">
2805 <sect1>em_install<label id="em_install"><p>
2809 <tag/Function/Install an already loaded extended memory driver.
2810 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2811 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
2812 <tag/Description/The function installs an already loaded extended memory driver
2813 and returns an error code. The function may be used to install a driver linked
2814 statically to the program.
2815 <tag/Notes/<itemize>
2816 <item>Not all drivers are able to detect if the supported hardware is really
2818 <item>The function is only available as fastcall function, so it may only be
2819 used in presence of a prototype.
2821 <tag/Availability/cc65
2823 <ref id="em_load_driver" name="em_load_driver">,
2824 <ref id="em_uninstall" name="em_uninstall">,
2825 <ref id="em_unload" name="em_unload">
2831 <sect1>em_load_driver<label id="em_load_driver"><p>
2835 <tag/Function/Load and initialize an extended memory driver.
2836 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2837 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
2838 <tag/Description/Load an extended memory driver into memory and initialize
2839 it. The function returns an error code that tells if all this has been
2841 <tag/Notes/<itemize>
2842 <item>Not all drivers are able to detect if the supported hardware is really
2844 <item>The function is only available as fastcall function, so it may only be
2845 used in presence of a prototype.
2846 <item>The driver is loaded by name, so currently you must know the type of
2847 extended memory that should be supported. There is no autodetect capability.
2849 <tag/Availability/cc65
2851 <ref id="em_unload" name="em_unload">
2857 <sect1>em_map<label id="em_map"><p>
2861 <tag/Function/Make a page of extended memory accessible.
2862 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2863 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
2864 <tag/Description/The function maps one page of extended memory into linear
2865 memory and returns a pointer to the page frame. Depending on the hardware
2866 and driver, the data is either mapped into the address space or transfered
2867 into a buffer. If you don't need the actual contents of the page (for example
2868 because you're going to overwrite it completely), it is better to call
2869 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
2870 data if it is possible to avoid that.
2871 <tag/Notes/<itemize>
2872 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
2873 made any changes to the data in the window, call <tt/<ref id="em_commit"
2874 name="em_commit">/ first, or the changes are lost.
2875 <item>The function is only available as fastcall function, so it may only be
2876 used in presence of a prototype.
2877 <item>The function produces undefined results if no extended memory driver is
2880 <tag/Availability/cc65
2882 <ref id="em_commit" name="em_commit">,
2883 <ref id="em_load_driver" name="em_load_driver">,
2884 <ref id="em_use" name="em_use">
2890 <sect1>em_pagecount<label id="em_pagecount"><p>
2894 <tag/Function/Return the number of available extended memory pages.
2895 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2896 <tag/Declaration/<tt/unsigned em_pagecount (void);/
2897 <tag/Description/The function returns the size of the extended memory supported
2898 by the driver in 256 byte pages.
2899 <tag/Notes/<itemize>
2900 <item>The function returns zero if no extended memory driver is loaded.
2901 <item>The function may return zero if the supported hardware was not detected.
2903 <tag/Availability/cc65
2905 <ref id="em_load_driver" name="em_load_driver">
2911 <sect1>em_uninstall<label id="em_uninstall"><p>
2915 <tag/Function/Uninstall an already loaded extended memory driver.
2916 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2917 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
2918 <tag/Description/The function uninstalls an already loaded extended memory
2919 driver but doesn't remove it from memory.
2920 <tag/Notes/<itemize>
2921 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
2922 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
2923 should be used instead of <tt/em_uninstall/ so the driver is also removed
2926 <tag/Availability/cc65
2928 <ref id="em_install" name="em_install">,
2929 <ref id="em_load_driver" name="em_load_driver">,
2930 <ref id="em_unload" name="em_unload">
2936 <sect1>em_unload<label id="em_unload"><p>
2940 <tag/Function/Unload an extended memory driver.
2941 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2942 <tag/Declaration/<tt/unsigned char em_unload (void);/
2943 <tag/Description/The function unloads a loaded extended memory driver and
2944 frees all memory allocated for the driver.
2945 <tag/Notes/<itemize>
2946 <item>The function does nothing if no driver is loaded.
2948 <tag/Availability/cc65
2950 <ref id="em_load_driver" name="em_load_driver">
2956 <sect1>em_use<label id="em_use"><p>
2960 <tag/Function/Prepare an extended memory page for use.
2961 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2962 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
2963 <tag/Description/The function maps one page of extended memory into linear
2964 memory and returns a pointer to the page frame. This function is similar to
2965 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
2966 actual memory window in the assumption that the existing data is wrong or
2967 will get overwritten.
2968 <tag/Notes/<itemize>
2969 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
2970 made any changes to the data in the window, call <tt/<ref id="em_commit"
2971 name="em_commit">/ first, or the changes are lost.
2972 <item>The function is only available as fastcall function, so it may only be
2973 used in presence of a prototype.
2974 <item>The function produces undefined results if no extended memory driver is
2977 <tag/Availability/cc65
2979 <ref id="em_commit" name="em_commit">,
2980 <ref id="em_load_driver" name="em_load_driver">,
2981 <ref id="em_map" name="em_map">
2987 <sect1>exit<label id="exit"><p>
2991 <tag/Function/Terminate the program.
2992 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2993 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
2994 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
2995 return code of the program. Before termination, all files are closed, buffered
2996 output is written and any functions registered with <tt/<ref id="atexit"
2997 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
2998 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3000 <tag/Notes/<itemize>
3001 <item>The function is only available as fastcall function, so it may only
3002 be used in presence of a prototype.
3003 <item>It depends on the host machine if the program return code can be
3004 evaluated or is ignored.
3006 <tag/Availability/ISO 9899
3008 <ref id="abort" name="abort">,
3009 <ref id="exit" name="exit">
3015 <sect1>exec<label id="exec"><p>
3019 <tag/Function/Execute a program file.
3020 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3021 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3022 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3023 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3024 then loading and starting the program named in the first argument, passing
3025 the command line specified as second argument. Instead of an empty string,
3026 a <tt/NULL/ pointer may be passed as second parameter.
3027 On success, the function does not return. On failure, -1 is returned and
3028 <tt/errno/ contains an error code.
3029 <tag/Notes/<itemize>
3030 <item>The function is only available as fastcall function, so it may only
3031 be used in presence of a prototype.
3032 <item>On most platforms, the function needs to copy a small stub loader to
3033 some memory area outside the program space. This may collide with other
3034 programs. See the platform specific docs on this.
3035 <item>Because it is necessary to terminate the running program before the
3036 memory can be reused to load the new one, there is a high chance that the
3037 function may not be able to return on errors.
3038 <item>The command line is passed to the new program in the same way as cc65
3039 programs expect the command line. If the new program is not a cc65 generated
3040 program, it may not be able to read it.
3042 <tag/Availability/cc65
3044 <ref id="exit" name="exit">
3050 <sect1>fast<label id="fast"><p>
3054 <tag/Function/Switch the C128 into 2MHz mode.
3055 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3056 <tag/Declaration/<tt/void fast (void);/
3057 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
3058 will nearly double the speed compared to slow mode.
3059 <tag/Notes/<itemize>
3060 <item>The function is specific to the C128.
3061 <item>2MHz clock will not work in 40 column mode.
3063 <tag/Availability/C128
3065 <ref id="slow" name="slow">,
3066 <ref id="toggle_videomode" name="toggle_videomode">,
3067 <ref id="videomode" name="videomode">
3073 <sect1>feof<label id="feof"><p>
3077 <tag/Function/Return the end-of-file indicator of a stream.
3078 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3079 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3080 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3081 <tt/f/, and returns a non zero value if it is set.
3082 <tag/Notes/<itemize>
3083 <item>The indicator is set only after a read past the end of a file is
3085 <item>The function is only available as fastcall function, so it may only be
3086 used in presence of a prototype.
3088 <tag/Availability/ISO 9899
3090 <ref id="feof" name="clearerr">,
3091 <ref id="ferror" name="ferror">
3097 <sect1>ferror<label id="ferror"><p>
3101 <tag/Function/Return the error indicator of a stream.
3102 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3103 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3104 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3105 <tt/f/, and returns a non zero value if it is set.
3106 <tag/Notes/<itemize>
3107 <item>The function is only available as fastcall function, so it may only be
3108 used in presence of a prototype.
3110 <tag/Availability/ISO 9899
3112 <ref id="feof" name="clearerr">,
3113 <ref id="ferror" name="feof">
3119 <sect1>fileno<label id="fileno"><p>
3123 <tag/Function/Return the file handle used by a stream.
3124 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3125 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3126 <tag/Description/The <tt/fileno/ function returns the file handle used
3127 internally by a C stream. This file handle (an integer) can be used as a
3128 handle for the POSIX input/output functions.
3129 <tag/Notes/<itemize>
3130 <item>The function is only available as fastcall function, so it may only be
3131 used in presence of a prototype.
3132 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3133 file may have unpredictable results.
3135 <tag/Availability/POSIX 1003.1
3137 <ref id="creat" name="creat">,
3138 <ref id="open" name="open"> <!-- , -->
3139 <!-- <ref id="read" name="read">, -->
3140 <!-- <ref id="write" name="write"> -->
3146 <sect1>free<label id="free"><p>
3150 <tag/Function/Free a block of dynamic memory.
3151 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3152 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3153 <tag/Description/Free a block of dynamic memory previously allocated with
3154 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3155 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3156 pointer is <tt/NULL/, no action is performed.
3157 <tag/Notes/<itemize>
3158 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3159 behaviour and may crash your program.
3160 <item>The function is only available as fastcall function, so it may only
3161 be used in presence of a prototype.
3163 <tag/Availability/ISO 9899
3165 <ref id="_heapadd" name="_heapadd">,
3166 <ref id="_heapblocksize" name="_heapblocksize">,
3167 <ref id="_heapmaxavail" name="_heapmaxavail">,
3168 <ref id="_heapmemavail" name="_heapmemavail">,
3169 <ref id="calloc" name="calloc">,
3170 <ref id="malloc" name="malloc">,
3171 <ref id="realloc" name="realloc">
3177 <sect1>get_ostype<label id="get_ostype"><p>
3181 <tag/Function/The function returns the operating system, the program runs on.
3182 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3183 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3184 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3185 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3186 all supported targets. If it exists, it returns a number that identifies the
3187 operating system or machine type, the program runs on. The machine dependent
3188 header files define constants that can be used to check the return code.
3189 <tag/Notes/<itemize>
3190 <item>The function does not exist on all platforms.
3191 <item>The return codes are platform dependent.
3193 <tag/Availability/cc65 (not all platforms)
3199 <sect1>getcpu<label id="getcpu"><p>
3203 <tag/Function/Determine on which CPU the program is running.
3204 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3205 <tag/Declaration/<tt/unsigned char getcpu (void);/
3206 <tag/Description/The function checks on which CPU the code is running. It
3207 returns one of the constants<itemize>
3209 <item><tt/CPU_65C02/
3210 <item><tt/CPU_65816/
3212 <tag/Notes/<itemize>
3213 <item>Other, more exotic CPU types are not disinguished.
3215 <tag/Availability/cc65
3221 <sect1>getenv<label id="getenv"><p>
3225 <tag/Function/Return a value from the environment.
3226 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3227 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3228 <tag/Description/The function searches the environment for an entry that
3229 matches <tt/name/ and returns its value. The environment consists of a list
3230 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3232 <tag/Notes/<itemize>
3233 <item>What exactly is stored in the environment depends on the machine the
3234 program is running on.
3235 <item>The function is only available as fastcall function, so it may only
3236 be used in presence of a prototype.
3238 <tag/Availability/ISO 9899
3244 <sect1>getopt<label id="getopt"><p>
3248 <tag/Function/Parse command line options.
3249 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3250 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3251 const char* optstring);/
3252 <tag/Description/The function parses command line arguments, <tt/argc/ and
3253 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3254 is a string that contains command line option characters. If a character in
3255 <tt/optstring/ is followed by a colon, the option requires an argument. An
3256 option on the command line is recognized if it is one of the option characters
3258 <tt/getopt/ must be called repeatedly. It will return each option character
3259 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3260 option argument is placed in <tt/optarg/, the index of the next element on the
3261 command line to be processed is placed in <tt/optind/.
3262 <tag/Notes/<itemize>
3263 <item>The implementation will not reorder options. A non option on the command
3264 line will terminate option processing. All remaining arguments are not
3265 recognized as options, even if the start with a '-' character.
3266 <item>The function is only available as fastcall function, so it may only
3267 be used in presence of a prototype.
3269 <tag/Availability/POSIX.2
3275 <sect1>gotox<label id="gotox"><p>
3279 <tag/Function/Move the text mode cursor to a new X position.
3280 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3281 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3282 <tag/Description/The function moves the text mode cursor to the specified X
3283 position while leaving the Y position untouched. The leftmost position on the
3284 screen has the coordinate 0.
3285 <tag/Notes/<itemize>
3286 <item>The function is only available as fastcall function, so it may
3287 only be used in presence of a prototype.
3288 <item>Invalid values for the X position (out of screen coordinates) may
3289 lead to undefined behaviour.
3291 <tag/Availability/cc65
3293 <ref id="gotoy" name="gotoy">,
3294 <ref id="gotoxy" name="gotoxy">,
3295 <ref id="wherex" name="wherex">,
3296 <ref id="wherey" name="wherey">
3302 <sect1>gotoxy<label id="gotoxy"><p>
3306 <tag/Function/Move the text mode cursor to a new position.
3307 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3308 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3309 <tag/Description/The function moves the text mode cursor to the specified
3310 position. The leftmost position on the screen has the X coordinate 0, the
3311 topmost line has the Y coordinate 0.
3312 <tag/Notes/<itemize>
3313 <item>The function is only available as fastcall function, so it may only be
3314 used in presence of a prototype.
3315 <item>Invalid values for any of both coordinates (out of screen positions) may
3316 lead to undefined behaviour.
3318 <tag/Availability/cc65
3320 <ref id="gotox" name="gotox">,
3321 <ref id="gotoy" name="gotoy">,
3322 <ref id="wherex" name="wherex">,
3323 <ref id="wherey" name="wherey">
3329 <sect1>gotoy<label id="gotoy"><p>
3333 <tag/Function/Move the text mode cursor to a new Y position.
3334 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3335 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3336 <tag/Description/The function moves the text mode cursor to the specified Y
3337 position while leaving the X position untouched. The uppermost position on the
3338 screen has the coordinate 0.
3339 <tag/Notes/<itemize>
3340 <item>The function is only available as fastcall function, so it may
3341 only be used in presence of a prototype.
3342 <item>Invalid values for the Y position (out of screen coordinates) may lead
3343 to undefined behaviour.
3345 <tag/Availability/cc65
3347 <ref id="gotox" name="gotox">,
3348 <ref id="gotoxy" name="gotoxy">,
3349 <ref id="wherex" name="wherex">,
3350 <ref id="wherey" name="wherey">
3356 <sect1>isalnum<label id="isalnum"><p>
3360 <tag/Function/Check if a given character is a letter or digit.
3361 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3362 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3363 <tag/Description/The function returns a non zero value if the given argument
3364 is a letter or digit. The return value is zero if the character is anything
3366 <tag/Notes/<itemize>
3367 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3368 inline sequence generated by the macro will not work correctly for values
3369 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3370 this range. The non inline function may be accessed by <tt/#undef/'ing
3372 <item>When compiling without <tt/-Os/, the function is only available as
3373 fastcall function, so it may only be used in presence of a prototype.
3375 <tag/Availability/ISO 9899
3377 <ref id="isalpha" name="isalpha">,
3378 <ref id="isascii" name="isascii">,
3379 <ref id="isblank" name="isblank">,
3380 <ref id="iscntrl" name="iscntrl">,
3381 <ref id="isdigit" name="isdigit">,
3382 <ref id="isgraph" name="isgraph">,
3383 <ref id="islower" name="islower">,
3384 <ref id="isprint" name="isprint">,
3385 <ref id="ispunct" name="ispunct">,
3386 <ref id="isspace" name="isspace">,
3387 <ref id="isupper" name="isupper">,
3388 <ref id="isxdigit" name="isxdigit">
3394 <sect1>isalpha<label id="isalpha"><p>
3398 <tag/Function/Check if a given character is a letter.
3399 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3400 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3401 <tag/Description/The function returns a non zero value if the given argument
3402 is a letter. The return value is zero if the character is anything else.
3403 <tag/Notes/<itemize>
3404 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3405 inline sequence generated by the macro will not work correctly for values
3406 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3407 this range. The non inline function may be accessed by <tt/#undef/'ing the
3409 <item>When compiling without <tt/-Os/, the function is only available as
3410 fastcall function, so it may only be used in presence of a prototype.
3412 <tag/Availability/ISO 9899
3414 <ref id="isalnum" name="isalnum">,
3415 <ref id="isascii" name="isascii">,
3416 <ref id="isblank" name="isblank">,
3417 <ref id="iscntrl" name="iscntrl">,
3418 <ref id="isdigit" name="isdigit">,
3419 <ref id="isgraph" name="isgraph">,
3420 <ref id="islower" name="islower">,
3421 <ref id="isprint" name="isprint">,
3422 <ref id="ispunct" name="ispunct">,
3423 <ref id="isspace" name="isspace">,
3424 <ref id="isupper" name="isupper">,
3425 <ref id="isxdigit" name="isxdigit">
3431 <sect1>isascii<label id="isascii"><p>
3435 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3436 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3437 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3438 <tag/Description/The function returns a non zero value if the given argument
3439 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3440 <tag/Notes/<itemize>
3441 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3442 inline sequence generated by the macro will not work correctly for values
3443 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3444 this range. The non inline function may be accessed by <tt/#undef/'ing the
3446 <item>When compiling without <tt/-Os/, the function is only available as
3447 fastcall function, so it may only be used in presence of a prototype.
3449 <tag/Availability/ISO 9899
3451 <ref id="isalnum" name="isalnum">,
3452 <ref id="isalpha" name="isalpha">,
3453 <ref id="isblank" name="isblank">,
3454 <ref id="iscntrl" name="iscntrl">,
3455 <ref id="isdigit" name="isdigit">,
3456 <ref id="isgraph" name="isgraph">,
3457 <ref id="islower" name="islower">,
3458 <ref id="isprint" name="isprint">,
3459 <ref id="ispunct" name="ispunct">,
3460 <ref id="isspace" name="isspace">,
3461 <ref id="isupper" name="isupper">,
3462 <ref id="isxdigit" name="isxdigit">
3468 <sect1>isblank<label id="isblank"><p>
3472 <tag/Function/Check if a given character is a space or tab.
3473 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3474 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3475 <tag/Description/The function returns a non zero value if the given argument
3476 is a space or tab character. The return value is zero if the character is
3478 <tag/Notes/<itemize>
3479 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3480 inline sequence generated by the macro will not work correctly for values
3481 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3482 this range. The non inline function may be accessed by <tt/#undef/'ing the
3484 <item>When compiling without <tt/-Os/, the function is only available as
3485 fastcall function, so it may only be used in presence of a prototype.
3487 <tag/Availability/ISO 9899
3489 <ref id="isalnum" name="isalnum">,
3490 <ref id="isalpha" name="isalpha">,
3491 <ref id="isascii" name="isascii">,
3492 <ref id="iscntrl" name="iscntrl">,
3493 <ref id="isdigit" name="isdigit">,
3494 <ref id="isgraph" name="isgraph">,
3495 <ref id="islower" name="islower">,
3496 <ref id="isprint" name="isprint">,
3497 <ref id="ispunct" name="ispunct">,
3498 <ref id="isspace" name="isspace">,
3499 <ref id="isupper" name="isupper">,
3500 <ref id="isxdigit" name="isxdigit">
3506 <sect1>iscntrl<label id="iscntrl"><p>
3510 <tag/Function/Check if a given character is a control character.
3511 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3512 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3513 <tag/Description/The function returns a non zero value if the given argument
3514 is a control character. The return value is zero if the character is anything
3516 <tag/Notes/<itemize>
3517 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3518 inline sequence generated by the macro will not work correctly for values
3519 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3520 this range. The non inline function may be accessed by <tt/#undef/'ing the
3522 <item>When compiling without <tt/-Os/, the function is only available as
3523 fastcall function, so it may only be used in presence of a prototype.
3525 <tag/Availability/ISO 9899
3527 <ref id="isalnum" name="isalnum">,
3528 <ref id="isalpha" name="isalpha">,
3529 <ref id="isascii" name="isascii">,
3530 <ref id="isblank" name="isblank">,
3531 <ref id="isdigit" name="isdigit">,
3532 <ref id="isgraph" name="isgraph">,
3533 <ref id="islower" name="islower">,
3534 <ref id="isprint" name="isprint">,
3535 <ref id="ispunct" name="ispunct">,
3536 <ref id="isspace" name="isspace">,
3537 <ref id="isupper" name="isupper">,
3538 <ref id="isxdigit" name="isxdigit">
3544 <sect1>isdigit<label id="isdigit"><p>
3548 <tag/Function/Check if a given character is a digit.
3549 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3550 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
3551 <tag/Description/The function returns a non zero value if the given argument
3552 is a digit. The return value is zero if the character is anything else.
3553 <tag/Notes/<itemize>
3554 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3555 inline sequence generated by the macro will not work correctly for values
3556 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3557 this range. The non inline function may be accessed by <tt/#undef/'ing the
3559 <item>When compiling without <tt/-Os/, the function is only available as
3560 fastcall function, so it may only be used in presence of a prototype.
3562 <tag/Availability/ISO 9899
3564 <ref id="isalnum" name="isalnum">,
3565 <ref id="isalpha" name="isalpha">,
3566 <ref id="isascii" name="isascii">,
3567 <ref id="isblank" name="isblank">,
3568 <ref id="iscntrl" name="iscntrl">,
3569 <ref id="isgraph" name="isgraph">,
3570 <ref id="islower" name="islower">,
3571 <ref id="isprint" name="isprint">,
3572 <ref id="ispunct" name="ispunct">,
3573 <ref id="isspace" name="isspace">,
3574 <ref id="isupper" name="isupper">,
3575 <ref id="isxdigit" name="isxdigit">
3581 <sect1>isgraph<label id="isgraph"><p>
3585 <tag/Function/Check if a given character is a printable character (except
3587 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3588 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
3589 <tag/Description/The function returns a non zero value if the given argument
3590 is a printable character with the exception of space. The return value is zero
3591 if the character is anything else.
3592 <tag/Notes/<itemize>
3593 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3594 inline sequence generated by the macro will not work correctly for values
3595 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3596 this range. The non inline function may be accessed by <tt/#undef/'ing the
3598 <item>When compiling without <tt/-Os/, the function is only available as
3599 fastcall function, so it may only be used in presence of a prototype.
3601 <tag/Availability/ISO 9899
3603 <ref id="isalnum" name="isalnum">,
3604 <ref id="isalpha" name="isalpha">,
3605 <ref id="isascii" name="isascii">,
3606 <ref id="isblank" name="isblank">,
3607 <ref id="iscntrl" name="iscntrl">,
3608 <ref id="isdigit" name="isdigit">,
3609 <ref id="islower" name="islower">,
3610 <ref id="isprint" name="isprint">,
3611 <ref id="ispunct" name="ispunct">,
3612 <ref id="isspace" name="isspace">,
3613 <ref id="isupper" name="isupper">,
3614 <ref id="isxdigit" name="isxdigit">
3620 <sect1>islower<label id="islower"><p>
3624 <tag/Function/Check if a given character is a lower case letter.
3625 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3626 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
3627 <tag/Description/The function returns a non zero value if the given argument
3628 is a lower case letter. The return value is zero if the character is anything
3630 <tag/Notes/<itemize>
3631 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3632 inline sequence generated by the macro will not work correctly for values
3633 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3634 this range. The non inline function may be accessed by <tt/#undef/'ing the
3636 <item>When compiling without <tt/-Os/, the function is only available as
3637 fastcall function, so it may only be used in presence of a prototype.
3639 <tag/Availability/ISO 9899
3641 <ref id="isalnum" name="isalnum">,
3642 <ref id="isalpha" name="isalpha">,
3643 <ref id="isascii" name="isascii">,
3644 <ref id="isblank" name="isblank">,
3645 <ref id="iscntrl" name="iscntrl">,
3646 <ref id="isdigit" name="isdigit">,
3647 <ref id="isgraph" name="isgraph">,
3648 <ref id="isprint" name="isprint">,
3649 <ref id="ispunct" name="ispunct">,
3650 <ref id="isspace" name="isspace">,
3651 <ref id="isupper" name="isupper">,
3652 <ref id="isxdigit" name="isxdigit">
3658 <sect1>isprint<label id="isprint"><p>
3662 <tag/Function/Check if a given character is a printable character.
3663 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3664 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
3665 <tag/Description/The function returns a non zero value if the given argument
3666 is a printable character (this includes the space character). The return value
3667 is zero if the character is anything else.
3668 <tag/Notes/<itemize>
3669 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3670 inline sequence generated by the macro will not work correctly for values
3671 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3672 this range. The non inline function may be accessed by <tt/#undef/'ing the
3674 <item>When compiling without <tt/-Os/, the function is only available as
3675 fastcall function, so it may only be used in presence of a prototype.
3677 <tag/Availability/ISO 9899
3679 <ref id="isalnum" name="isalnum">,
3680 <ref id="isalpha" name="isalpha">,
3681 <ref id="isascii" name="isascii">,
3682 <ref id="isblank" name="isblank">,
3683 <ref id="iscntrl" name="iscntrl">,
3684 <ref id="isdigit" name="isdigit">,
3685 <ref id="isgraph" name="isgraph">,
3686 <ref id="islower" name="islower">,
3687 <ref id="ispunct" name="ispunct">,
3688 <ref id="isspace" name="isspace">,
3689 <ref id="isupper" name="isupper">,
3690 <ref id="isxdigit" name="isxdigit">
3696 <sect1>ispunct<label id="ispunct"><p>
3700 <tag/Function/Check if a given character is a printable character but not a
3701 space or an alphanumeric character.
3702 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3703 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
3704 <tag/Description/The function returns a non zero value if the given argument
3705 is a printable character, but not a space or anything alphanumeric. The return
3706 value is zero if the character is anything else.
3707 <tag/Notes/<itemize>
3708 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3709 inline sequence generated by the macro will not work correctly for values
3710 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3711 this range. The non inline function may be accessed by <tt/#undef/'ing the
3713 <item>When compiling without <tt/-Os/, the function is only available as
3714 fastcall function, so it may only be used in presence of a prototype.
3716 <tag/Availability/ISO 9899
3718 <ref id="isalnum" name="isalnum">,
3719 <ref id="isalpha" name="isalpha">,
3720 <ref id="isascii" name="isascii">,
3721 <ref id="isblank" name="isblank">,
3722 <ref id="iscntrl" name="iscntrl">,
3723 <ref id="isdigit" name="isdigit">,
3724 <ref id="isgraph" name="isgraph">,
3725 <ref id="islower" name="islower">,
3726 <ref id="isprint" name="isprint">,
3727 <ref id="isspace" name="isspace">,
3728 <ref id="isupper" name="isupper">,
3729 <ref id="isxdigit" name="isxdigit">
3735 <sect1>isspace<label id="isspace"><p>
3739 <tag/Function/Check if a given character is a white-space character.
3740 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3741 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
3742 <tag/Description/The function returns a non zero value if the given argument
3743 is a white space character. The return value is zero if the character is
3744 anything else. The standard white space characters are: space, formfeed ('\f'),
3745 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
3747 <tag/Notes/<itemize>
3748 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3749 inline sequence generated by the macro will not work correctly for values
3750 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3751 this range. The non inline function may be accessed by <tt/#undef/'ing the
3753 <item>When compiling without <tt/-Os/, the function is only available as
3754 fastcall function, so it may only be used in presence of a prototype.
3756 <tag/Availability/ISO 9899
3758 <ref id="isalnum" name="isalnum">,
3759 <ref id="isalpha" name="isalpha">,
3760 <ref id="isascii" name="isascii">,
3761 <ref id="isblank" name="isblank">,
3762 <ref id="iscntrl" name="iscntrl">,
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="isupper" name="isupper">,
3769 <ref id="isxdigit" name="isxdigit">
3775 <sect1>isupper<label id="isupper"><p>
3779 <tag/Function/Check if a given character is an upper case letter.
3780 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3781 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
3782 <tag/Description/The function returns a non zero value if the given argument
3783 is an upper case letter. The return value is zero if the character is anything
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="isdigit" name="isdigit">,
3802 <ref id="isgraph" name="isgraph">,
3803 <ref id="islower" name="islower">,
3804 <ref id="isprint" name="isprint">,
3805 <ref id="ispunct" name="ispunct">,
3806 <ref id="isspace" name="isspace">,
3807 <ref id="isxdigit" name="isxdigit">
3813 <sect1>isxdigit<label id="isxdigit"><p>
3817 <tag/Function/Check if a given character is a hexadecimal digit.
3818 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3819 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
3820 <tag/Description/The function returns a non zero value if the given argument
3821 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
3822 character is anything else.
3823 <tag/Notes/<itemize>
3824 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3825 inline sequence generated by the macro will not work correctly for values
3826 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3827 this range. The non inline function may be accessed by <tt/#undef/'ing the
3829 <item>When compiling without <tt/-Os/, the function is only available as
3830 fastcall function, so it may only be used in presence of a prototype.
3832 <tag/Availability/ISO 9899
3834 <ref id="isalnum" name="isalnum">,
3835 <ref id="isalpha" name="isalpha">,
3836 <ref id="isascii" name="isascii">,
3837 <ref id="isblank" name="isblank">,
3838 <ref id="iscntrl" name="iscntrl">,
3839 <ref id="isdigit" name="isdigit">,
3840 <ref id="isgraph" name="isgraph">,
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">
3851 <sect1>itoa<label id="itoa"><p>
3855 <tag/Function/Convert an integer into a string.
3856 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3857 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
3858 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
3859 <tt/radix/ as the base.
3860 <tag/Notes/<itemize>
3861 <item>There are no provisions to prevent a buffer overflow.
3862 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
3863 <item>The function is non standard, so it is not available in strict ANSI mode.
3864 You should probably use <tt/sprintf/ instead.
3865 <item>The function is only available as fastcall function, so it may only be
3866 used in presence of a prototype.
3868 <tag/Availability/cc65
3870 <ref id="atoi" name="atoi">,
3871 <ref id="atol" name="atol">,
3872 <ref id="ltoa" name="ltoa">,
3873 <ref id="ultoa" name="ultoa">,
3874 <ref id="utoa" name="utoa">
3880 <sect1>joy_count<label id="joy_count"><p>
3884 <tag/Function/Return the number of joysticks supported by the current driver.
3885 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3886 <tag/Declaration/<tt/unsigned char joy_count (void);/
3887 <tag/Description/The function returns a the number of joysticks supported
3888 by the current joystick driver.
3889 <tag/Notes/<itemize>
3890 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3891 name="joy_load_driver"> before calling this function.
3892 <item>The function returns the number of joysticks supported by the driver.
3893 There's no way to check for the number of actually connected joysticks.
3895 <tag/Availability/cc65
3897 <ref id="joy_load_driver" name="joy_load_driver">,
3898 <ref id="joy_read" name="joy_read">
3904 <sect1>joy_install<label id="joy_install"><p>
3908 <tag/Function/Install an already loaded driver and return an error code.
3909 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3910 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
3911 <tag/Description/The function installs a driver that was already loaded into
3912 memory (or linked statically to the program). It returns an error code
3913 (<tt/JOY_ERR_OK/ in case of success).
3914 <tag/Notes/<itemize>
3915 <item>The function is only available as fastcall function, so it may only be
3916 used in presence of a prototype.
3918 <tag/Availability/cc65
3920 <ref id="joy_load_driver" name="joy_load_driver">,
3921 <ref id="joy_uninstall" name="joy_uninstall">,
3922 <ref id="joy_unload" name="joy_unload">
3928 <sect1>joy_load_driver<label id="joy_load_driver"><p>
3932 <tag/Function/Load a driver from disk and install it.
3933 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3934 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
3935 <tag/Description/The function loads a driver with the given name from disk
3936 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
3937 driver was successfully loaded and installed.
3938 <tag/Notes/<itemize>
3939 <item>The function is only available as fastcall function, so it may only be
3940 used in presence of a prototype.
3942 <tag/Availability/cc65
3944 <ref id="joy_install" name="joy_install">,
3945 <ref id="joy_uninstall" name="joy_uninstall">,
3946 <ref id="joy_unload" name="joy_unload">
3952 <sect1>joy_read<label id="joy_read"><p>
3956 <tag/Function/Read the status of a joystick.
3957 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3958 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
3959 <tag/Description/The function reads the status bits for a joystick. The number
3960 of the joystick is passed as parameter. The result may be examined by using one
3961 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
3962 <tag/Notes/<itemize>
3963 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3964 name="joy_load_driver"> before calling this function.
3965 <item>The function is only available as fastcall function, so it may only be
3966 used in presence of a prototype.
3968 <tag/Availability/cc65
3970 <ref id="joy_count" name="joy_count">,
3971 <ref id="joy_load_driver" name="joy_load_driver">,
3972 <ref id="joy_unload" name="joy_unload">
3978 <sect1>joy_uninstall<label id="joy_uninstall"><p>
3982 <tag/Function/Uninstall the current joystick driver.
3983 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3984 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
3985 <tag/Description/The function uninstalls the currently installed joystick
3986 driver. It does not remove the driver from memory. The function returns an
3987 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
3988 <tag/Notes/<itemize>
3989 <item>A joystick driver must be installed using <ref id="joy_install"
3990 name="joy_install"> before calling this function.
3992 <tag/Availability/cc65
3994 <ref id="joy_install" name="joy_install">,
3995 <ref id="joy_load_driver" name="joy_load_driver">,
3996 <ref id="joy_unload" name="joy_unload">
4002 <sect1>joy_unload<label id="joy_unload"><p>
4006 <tag/Function/Uninstall, then unload the current joystick driver.
4007 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4008 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4009 <tag/Description/The function uninstalls the currently installed joystick
4010 driver and removes it from memory. An error code is returned, which is
4011 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4012 <tag/Notes/<itemize>
4013 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4014 name="joy_load_driver"> before calling this function.
4016 <tag/Availability/cc65
4018 <ref id="joy_load_driver" name="joy_load_driver">
4024 <sect1>kbhit<label id="kbhit"><p>
4028 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4029 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4030 <tag/Declaration/<tt/unsigned char kbhit (void);/
4031 <tag/Description/The function returns a value of zero if there is no character
4032 waiting to be read from the keyboard. It returns non zero otherwise.
4033 <tag/Notes/<itemize>
4034 <item>If the system does not support a keyboard buffer (most systems
4035 do), the function is rather useless.
4037 <tag/Availability/cc65
4039 <ref id="cgetc" name="cgetc">,
4040 <ref id="cursor" name="cursor">
4046 <sect1>kbrepeat<label id="kbrepeat"><p>
4050 <tag/Function/Set the keyboard repeat mode.
4051 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4052 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4053 <tag/Description/This function changes which keys have automatic repeat when
4054 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4055 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4056 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4057 it can be restored later.
4058 <tag/Notes/<itemize>
4059 <item>The function is available only as a fastcall function; so, it may be used
4060 only in the presence of a prototype.
4062 <tag/Availability/cc65
4068 <sect1>labs<label id="labs"><p>
4072 <tag/Function/Returns the absolute value of a long integer.
4073 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4074 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4075 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4077 <tag/Notes/<itemize>
4078 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4079 <item>The function is only available as fastcall function, so it may only be
4080 used in presence of a prototype.
4082 <tag/Availability/ISO 9899
4084 <ref id="abs" name="abs">
4090 <sect1>ltoa<label id="ltoa"><p>
4094 <tag/Function/Convert a long integer into a string.
4095 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4096 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4097 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4098 using <tt/radix/ as the base.
4099 <tag/Notes/<itemize>
4100 <item>There are no provisions to prevent a buffer overflow.
4101 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4102 <item>The function is non standard, so it is not available in strict ANSI mode.
4103 You should probably use <tt/sprintf/ instead.
4104 <item>The function is only available as fastcall function, so it may only be
4105 used in presence of a prototype.
4107 <tag/Availability/cc65
4109 <ref id="atoi" name="atoi">,
4110 <ref id="atol" name="atol">,
4111 <ref id="itoa" name="itoa">,
4112 <ref id="ultoa" name="ultoa">,
4113 <ref id="utoa" name="utoa">
4119 <sect1>localeconv<label id="localeconv"><p>
4123 <tag/Function/Returns a pointer to the current locale structure.
4124 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4125 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4126 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4128 <tag/Notes/<itemize>
4129 <item>cc65 supports only the "C" locale, so even after setting a new locale
4130 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4133 <tag/Availability/ISO 9899
4135 <ref id="setlocale" name="setlocale">
4141 <sect1>longjmp<label id="longjmp"><p>
4145 <tag/Function/Non local goto.
4146 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4147 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4148 <tag/Description/The <tt/longjmp/ function restores a program context from the
4149 data in <tt/buf/, which must have been set by a preceeding call to
4150 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4151 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4153 <tag/Notes/<itemize>
4154 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4155 was called with a value of one.
4156 <item>The function is only available as fastcall function, so it may only
4157 be used in presence of a prototype.
4159 <tag/Availability/ISO 9899
4161 <ref id="setjmp" name="setjmp">
4167 <sect1>malloc<label id="malloc"><p>
4171 <tag/Function/Allocate dynamic memory.
4172 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4173 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4174 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4175 pointer to the allocated memory block. On error (not enough memory available),
4176 <tt/malloc/ returns <tt/NULL/.
4177 <tag/Notes/<itemize>
4178 <item>The function is only available as fastcall function, so it may only
4179 be used in presence of a prototype.
4181 <tag/Availability/ISO 9899
4183 <ref id="_heapadd" name="_heapadd">,
4184 <ref id="_heapblocksize" name="_heapblocksize">,
4185 <ref id="_heapmaxavail" name="_heapmaxavail">,
4186 <ref id="_heapmemavail" name="_heapmemavail">,
4187 <ref id="calloc" name="calloc">,
4188 <ref id="free" name="free">,
4189 <ref id="realloc" name="realloc">,
4190 <ref id="strdup" name="strdup">
4196 <sect1>memchr<label id="memchr"><p>
4200 <tag/Function/Search for a character in a block of raw memory.
4201 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4202 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4203 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4204 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4205 that is of size <tt/count/. Upon completion, the function returns a pointer to
4206 the character found, or a null pointer if the character was not found.
4207 <tag/Notes/<itemize>
4208 <item>The function is only available as fastcall function, so it may only
4209 be used in presence of a prototype.
4211 <tag/Availability/ISO 9899
4213 <ref id="strchr" name="strchr">
4219 <sect1>memcmp<label id="memcmp"><p>
4223 <tag/Function/Compare two memory areas.
4224 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4225 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4226 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4227 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4228 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4229 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4230 <tag/Notes/<itemize>
4231 <item>The function is only available as fastcall function, so it may only
4232 be used in presence of a prototype.
4234 <tag/Availability/ISO 9899
4236 <ref id="strcmp" name="strcmp">,
4237 <ref id="memmove" name="memmove">,
4238 <ref id="memset" name="memset">
4244 <sect1>memcpy<label id="memcpy"><p>
4248 <tag/Function/Copy a memory area.
4249 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4250 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4251 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4252 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4254 <tag/Notes/<itemize>
4255 <item>The result is undefined if the memory areas do overlap. Use
4256 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4257 <item>The function is only available as fastcall function, so it may only
4258 be used in presence of a prototype.
4260 <tag/Availability/ISO 9899
4262 <ref id="_swap" name="_swap">,
4263 <ref id="memmove" name="memmove">,
4264 <ref id="memset" name="memset">
4270 <sect1>memmove<label id="memmove"><p>
4274 <tag/Function/Copy a memory area.
4275 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4276 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4277 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4278 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4280 <tag/Notes/<itemize>
4281 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4282 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4283 <item>The function is only available as fastcall function, so it may only
4284 be used in presence of a prototype.
4286 <tag/Availability/ISO 9899
4288 <ref id="_swap" name="_swap">,
4289 <ref id="memcpy" name="memcpy">,
4290 <ref id="memset" name="memset">
4296 <sect1>memset<label id="memset"><p>
4300 <tag/Function/Fill a memory area.
4301 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4302 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4303 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4304 the value <tt/val/. The function returns <tt/p/.
4305 <tag/Notes/<itemize>
4306 <item>The function is only available as fastcall function, so it may only
4307 be used in presence of a prototype.
4309 <tag/Availability/ISO 9899
4311 <ref id="_swap" name="_swap">,
4312 <ref id="bzero" name="bzero">,
4313 <ref id="memcpy" name="memcpy">,
4314 <ref id="memmove" name="memmove">
4320 <sect1>mod_free<label id="mod_free"><p>
4324 <tag/Function/Free a relocatable module.
4325 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4326 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4327 <tag/Description/The function will free a module loaded into memory by use of
4328 the <tt/<ref id="mod_load" name="mod_load">/ function.
4329 <tag/Notes/<itemize>
4330 <item>The pointer passed as parameter is the pointer to the module memory,
4331 not the pointer to the control structure.
4332 <item>The function is available only as a fastcall function; so, it may be used
4333 only in the presence of a prototype.
4335 <tag/Availability/cc65
4337 <ref id="mod_load" name="mod_load">
4343 <sect1>mod_load<label id="mod_load"><p>
4347 <tag/Function/Load a relocatable module.
4348 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4349 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4350 <tag/Description/The function will load a code module into memory and relocate
4351 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4352 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4353 the module just loaded. Possible error codes are:
4355 <item><tt/MLOAD_OK/ - Module load successful
4356 <item><tt/MLOAD_ERR_READ/ - Read error
4357 <item><tt/MLOAD_ERR_HDR/ - Header error
4358 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4359 <item><tt/MLOAD_ERR_FMT/ - Data format error
4360 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4362 <tag/Notes/<itemize>
4363 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4364 relocatable o65 modules for use with this function.
4365 <item>The function is available only as a fastcall function; so, it may be used
4366 only in the presence of a prototype.
4368 <tag/Availability/cc65
4370 <ref id="mod_free" name="mod_free">
4376 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4380 <tag/Function/Specify a bounding box for the mouse cursor.
4381 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4382 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4383 <tag/Description/The function allows to set a bounding box for mouse movement.
4384 <tag/Notes/<itemize>
4385 <item>The function does not check if the mouse cursor is currently within the
4386 given rectangle. Placing the mouse cursor within the bounding box is the
4387 responsibility of the programmer.
4388 <item>While the bounding box may be larger than the actual screen size, the
4389 standard mouse cursor draw routines may fail to set the cursor to coordinates
4390 outside of the screen area. Depending on the platform, you may have to supply
4391 your own mouse cursor routines.
4392 <item>The function is only available as fastcall function, so it may only be
4393 used in presence of a prototype.
4395 <tag/Availability/cc65
4397 <ref id="mouse_getbox" name="mouse_getbox">,
4398 <ref id="mouse_move" name="mouse_move">
4404 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4408 <tag/Function/Return the current bounding box for the mouse cursor.
4409 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4410 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4411 <tag/Description/The function queries the current bounding box for mouse
4413 <tag/Notes/<itemize>
4414 <item>The function is only available as fastcall function, so it may only be
4415 used in presence of a prototype.
4417 <tag/Availability/cc65
4419 <ref id="mouse_move" name="mouse_move">,
4420 <ref id="mouse_setbox" name="mouse_setbox">
4426 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4430 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4431 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4432 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4433 <tag/Description/The function returns a bit mask that encodes the state of the
4434 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4436 <tag/Availability/cc65
4438 <ref id="mouse_info" name="mouse_info">,
4439 <ref id="mouse_pos" name="mouse_pos">
4445 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4449 <tag/Function/Return a readable error message for an error code.
4450 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4451 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4453 <tag/Description/The function returns an error message (in english) for the
4454 error code passed parameter.
4455 <tag/Notes/<itemize>
4456 <item>The function will return "Unknown error" for invalid error codes.
4457 <item>The function is only available as fastcall function, so it may only be
4458 used in presence of a prototype.
4460 <tag/Availability/cc65
4462 <ref id="mouse_load_driver" name="mouse_load_driver">,
4463 <ref id="mouse_uninstall" name="mouse_uninstall">,
4464 <ref id="mouse_unload" name="mouse_unload">
4470 <sect1>mouse_hide<label id="mouse_hide"><p>
4474 <tag/Function/Hide the mouse pointer.
4475 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4476 <tag/Declaration/<tt/void mouse_hide (void);/
4477 <tag/Description/The function hides the mouse pointer. It manages a counter
4478 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4479 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4480 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4482 <tag/Availability/cc65
4484 <ref id="mouse_show" name="mouse_show">
4490 <sect1>mouse_info<label id="mouse_info"><p>
4494 <tag/Function/Return the state of the mouse buttons and the position of the
4496 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4497 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
4498 <tag/Description/The function returns the state of the mouse buttons and the
4499 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
4500 <tag/Notes/<itemize>
4501 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
4502 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
4503 name="mouse_pos">/ instead.
4504 <item>The function is only available as fastcall function, so it may only be
4505 used in presence of a prototype.
4507 <tag/Availability/cc65
4509 <ref id="mouse_buttons" name="mouse_buttons">,
4510 <ref id="mouse_pos" name="mouse_pos">
4516 <sect1>mouse_install<label id="mouse_install"><p>
4520 <tag/Function/Install an already loaded mouse driver.
4521 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4522 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
4523 mouse_callbacks* c, void* driver);/
4524 <tag/Description/The function installs an already loaded mouse driver and
4525 returns an error code. The <tt/mouse_callbacks/ structure passed as first
4526 parameter contains pointers to routines needed to move or hide/show the mouse
4527 pointer. Defaults for these routines are supplied by the library, so if you
4528 can live with these defaults (which are platform specific), just pass a
4529 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
4530 driver linked statically to the program.
4531 <tag/Notes/<itemize>
4532 <item>Not all drivers are able to detect if the supported hardware is really
4534 <item>After installing a driver, the mouse cursor is hidden.
4535 <item>The function is only available as fastcall function, so it may only be
4536 used in presence of a prototype.
4538 <tag/Availability/cc65
4540 <ref id="mouse_load_driver" name="mouse_load_driver">,
4541 <ref id="mouse_uninstall" name="mouse_uninstall">,
4542 <ref id="mouse_unload" name="mouse_unload">
4548 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
4552 <tag/Function/Call the driver specific ioctl function.
4553 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4554 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
4555 <tag/Description/The function calls the IOCTL entry in the mouse driver,
4556 which is driver specific. The <tt/code/ parameter will choose between
4557 different IOCTL functions, and the <tt/data/ depends on code. The
4558 function returns an error code. The purpose of this function is to allow
4559 for driver specific extensions. See the documentation for a specific mouse
4560 driver for supported ioctl calls.
4561 <tag/Notes/<itemize>
4562 <item>Calling this function is non portable, because each driver may
4563 implement different ioctl calls (or none at all).
4564 <item>The function is only available as fastcall function, so it may only be
4565 used in presence of a prototype.
4567 <tag/Availability/cc65
4573 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
4577 <tag/Function/Load and initialize a mouse driver.
4578 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4579 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
4580 mouse_callbacks* c, const char* driver);/
4581 <tag/Description/Load a mouse driver into memory and initialize it. The
4582 function returns an error code that tells if the call has been successful. The
4583 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
4584 routines needed to move or hide/show the mouse pointer. Defaults for these
4585 routines are supplied by the library, so if you can live with these defaults
4586 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
4587 <tag/Notes/<itemize>
4588 <item>The driver is loaded by name, so currently you must know the type of
4589 mouse that should be supported. There is no autodetect capability.
4590 <item>Not all drivers are able to detect if the supported hardware is really
4592 <item>After installing a driver, the mouse cursor is hidden.
4593 <item>The function is only available as fastcall function, so it may only be
4594 used in presence of a prototype.
4596 <tag/Availability/cc65
4598 <ref id="mouse_install" name="mouse_install">,
4599 <ref id="mouse_uninstall" name="mouse_uninstall">,
4600 <ref id="mouse_unload" name="mouse_unload">
4606 <sect1>mouse_move<label id="mouse_move"><p>
4610 <tag/Function/Move the mouse cursor to a specific position.
4611 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4612 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
4613 <tag/Description/The function updates the mouse position. If the mouse cursor
4614 is visible, it is shown at the new position.
4615 <tag/Notes/<itemize>
4616 <item>The function does not check if the new position is within the bounding
4617 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
4618 <item>The function is only available as fastcall function, so it may only be
4619 used in presence of a prototype.
4621 <tag/Availability/cc65
4623 <ref id="mouse_getbox" name="mouse_getbox">,
4624 <ref id="mouse_setbox" name="mouse_setbox">
4630 <sect1>mouse_pos<label id="mouse_pos"><p>
4634 <tag/Function/Return the position of the mouse.
4635 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4636 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
4637 <tag/Description/The function returns the position of the mouse in the
4638 <tt/mouse_pos/ structure passed as parameter.
4639 <tag/Notes/<itemize>
4640 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
4641 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
4642 name="mouse_info">/ instead.
4643 <item>The function is only available as fastcall function, so it may only be
4644 used in presence of a prototype.
4646 <tag/Availability/cc65
4648 <ref id="mouse_buttons" name="mouse_buttons">,
4649 <ref id="mouse_info" name="mouse_info">
4655 <sect1>mouse_show<label id="mouse_show"><p>
4659 <tag/Function/Show the mouse pointer.
4660 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4661 <tag/Declaration/<tt/void mouse_show (void);/
4662 <tag/Description/The function shows the mouse pointer. It manages a counter
4663 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
4664 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
4665 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
4666 <tag/Availability/cc65
4668 <ref id="mouse_hide" name="mouse_hide">
4674 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
4678 <tag/Function/Uninstall an already loaded mouse driver.
4679 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4680 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
4681 <tag/Description/The function uninstalls an already loaded mouse driver but
4682 don't removes it from memory.
4683 <tag/Notes/<itemize>
4684 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
4685 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
4686 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
4689 <tag/Availability/cc65
4691 <ref id="mouse_install" name="mouse_install">,
4692 <ref id="mouse_load_driver" name="mouse_load_driver">,
4693 <ref id="mouse_unload" name="mouse_unload">
4699 <sect1>mouse_unload<label id="mouse_unload"><p>
4703 <tag/Function/Unload a mouse driver.
4704 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4705 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
4706 <tag/Description/The function unloads a loaded mouse driver and frees all
4707 memory allocated for the driver.
4708 <tag/Notes/<itemize>
4709 <item>The function does nothing if no driver is loaded.
4711 <tag/Availability/cc65
4713 <ref id="mouse_install" name="mouse_install">,
4714 <ref id="mouse_load_driver" name="mouse_load_driver">,
4715 <ref id="mouse_uninstall" name="mouse_uninstall">
4721 <sect1>offsetof<label id="offsetof"><p>
4725 <tag/Function/Calculate the offset of a struct or union member.
4726 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
4727 <tag/Declaration/<tt/size_t offsetof (type, member);/
4728 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
4729 or <tt/union/ member.
4730 <tag/Notes/<itemize>
4731 <item>The function is actually a macro.
4733 <tag/Availability/ISO 9899
4739 <sect1>open<label id="open"><p>
4743 <tag/Function/Open and possibly create a file.
4744 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
4745 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
4746 <tag/Description/<tt/open/ opens a file and returns the file descriptor
4747 associated with it. On error, -1 is returned and an error code is stored in
4748 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
4749 <tag/Notes/<itemize>
4750 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
4751 open, which is used as the permission mask when a new file is created. While
4752 cc65 allows to pass this argument, it is ignored.
4754 <tag/Availability/POSIX 1003.1
4756 <ref id="close" name="close">,
4757 <ref id="creat" name="creat">
4763 <sect1>opendir<label id="opendir"><p>
4767 <tag/Function/Open a directory.
4768 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
4769 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
4770 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
4771 descriptor associated with it. On error, NULL is returned and an error code is
4772 stored in <tt/errno/.
4773 <tag/Notes/<itemize>
4774 <item>The function is only available as fastcall function, so it may only
4775 be used in presence of a prototype.
4777 <tag/Availability/POSIX 1003.1
4779 <ref id="closedir" name="closedir">,
4780 <ref id="readdir" name="readdir">
4786 <sect1>peekbsys<label id="peekbsys"><p>
4790 <tag/Function/Read one byte from a location in the system bank.
4791 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4792 <tt/<ref id="cbm510.h" name="cbm510.h">/
4793 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
4794 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
4795 system bank (bank 15) of the CBM PET-II machines and returns it.
4796 <tag/Notes/<itemize>
4797 <item>The function is only available as fastcall function, so it may only
4798 be used in presence of a prototype.
4799 <item>This function may be a macro depending on the compiler options. The
4800 actual function is accessible by #undef'ing the macro.
4802 <tag/Availability/cc65
4804 <ref id="PEEK" name="PEEK">,
4805 <ref id="PEEKW" name="PEEKW">,
4806 <ref id="peekwsys" name="peekwsys">,
4807 <ref id="pokebsys" name="pokebsys">,
4808 <ref id="pokewsys" name="pokewsys">
4814 <sect1>peekwsys<label id="peekwsys"><p>
4818 <tag/Function/Read one word from a location in the system bank.
4819 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4820 <tt/<ref id="cbm510.h" name="cbm510.h">/
4821 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
4822 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
4823 system bank (bank 15) of the CBM PET-II machines and returns it. Following
4824 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
4825 high byte is read from <tt/addr+1/.
4826 <tag/Notes/<itemize>
4827 <item>The function is only available as fastcall function, so it may only
4828 be used in presence of a prototype.
4829 <item>The order in which the two bytes are read is undefined.
4831 <tag/Availability/cc65
4833 <ref id="PEEK" name="PEEK">,
4834 <ref id="PEEKW" name="PEEKW">,
4835 <ref id="peekbsys" name="peekbsys">,
4836 <ref id="pokebsys" name="pokebsys">,
4837 <ref id="pokewsys" name="pokewsys">
4843 <sect1>perror<label id="perror"><p>
4847 <tag/Function/Print an error message for the error in <tt/errno/.
4848 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4849 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
4850 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
4851 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
4852 a blank. Then the error message for the current contents of <tt/errno/ is
4853 printed followed by a newline. The message output is the same as returned by
4854 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
4855 <tag/Notes/<itemize>
4856 <item>The function is only available as fastcall function, so it may only
4857 be used in presence of a prototype.
4859 <tag/Availability/ISO 9899
4861 <ref id="_poserror" name="_poserror">,
4862 <ref id="strerror" name="strerror">
4868 <sect1>pokebsys<label id="pokebsys"><p>
4872 <tag/Function/Write one byte to a location in the system bank.
4873 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4874 <tt/<ref id="cbm510.h" name="cbm510.h">/
4875 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
4876 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
4877 system bank (bank 15) of the CBM PET-II machines.
4878 <tag/Notes/<itemize>
4879 <item>The function is only available as fastcall function, so it may only
4880 be used in presence of a prototype.
4882 <tag/Availability/cc65
4884 <ref id="POKE" name="POKE">,
4885 <ref id="POKEW" name="POKEW">,
4886 <ref id="peekbsys" name="peekbsys">,
4887 <ref id="peekwsys" name="peekwsys">,
4888 <ref id="pokewsys" name="pokewsys">
4894 <sect1>pokewsys<label id="pokewsys"><p>
4898 <tag/Function/Write one word to a location in the system bank.
4899 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4900 <tt/<ref id="cbm510.h" name="cbm510.h">/
4901 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
4902 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
4903 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
4904 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
4905 high byte is written to <tt/addr+1/.
4906 <tag/Notes/<itemize>
4907 <item>The function is only available as fastcall function, so it may only
4908 be used in presence of a prototype.
4909 <item>The order in which the two bytes are written is undefined.
4911 <tag/Availability/cc65
4913 <ref id="POKE" name="POKE">,
4914 <ref id="POKEW" name="POKEW">,
4915 <ref id="peekbsys" name="peekbsys">,
4916 <ref id="peekwsys" name="peekwsys">,
4917 <ref id="pokebsys" name="pokebsys">
4923 <sect1>qsort<label id="qsort"><p>
4927 <tag/Function/Sort an array.
4928 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4929 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
4930 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
4931 <tag/Description/<tt/qsort/ sorts an array according to a given compare
4932 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
4933 is the number of elements, <tt/size/ the size of an element and <tt/compare/
4934 the function used to compare the members.
4935 <tag/Notes/<itemize>
4936 <item>If there are multiple members with the same key, the order after calling
4937 the function is undefined.
4938 <item>The function is only available as fastcall function, so it may only
4939 be used in presence of a prototype.
4940 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
4943 <tag/Availability/ISO 9899
4945 <ref id="bsearch" name="bsearch">
4951 <sect1>raise<label id="raise"><p>
4955 <tag/Function/Send a signal to the executing program.
4956 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4957 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
4958 <tag/Description/<tt/raise/ sends the given signal to the program. If the
4959 program has installed a signal handler for the signal, this signal handler
4960 will be executed. If no handler has been installed, the default action for
4961 the raised signal will be taken. The function returns zero on success,
4963 <tag/Notes/<itemize>
4964 <item>The function is only available as fastcall function, so it may only
4965 be used in presence of a prototype.
4967 <tag/Availability/ISO 9899
4969 <ref id="abort" name="abort">,
4970 <ref id="signal" name="signal">
4976 <sect1>rand<label id="rand"><p>
4980 <tag/Function/Return a pseudo random number.
4981 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4982 <tag/Declaration/<tt/int rand (void);/
4983 <tag/Description/The function returns a pseudo random number
4984 between 0 and <tt/RAND_MAX/ (exclusive).
4985 <tag/Notes/<itemize>
4986 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
4987 flow of numbers is generated.
4988 <item>On startup, the function behaves as if <ref id="srand" name="srand">
4989 had been used with an argument of 1.
4991 <tag/Availability/ISO 9899
4993 <ref id="_randomize" name="_randomize">,
4994 <ref id="srand" name="srand">
5000 <sect1>readdir<label id="readdir"><p>
5004 <tag/Function/Read a directory.
5005 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5006 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5007 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5008 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5009 and returns a pointer to it. If the end of directory is reached, or an error
5010 occurs, NULL is returned. In case of errors, an error code is stored into
5012 <tag/Notes/<itemize>
5013 <item>The function is only available as fastcall function, so it may only
5014 be used in presence of a prototype.
5015 <item>The returned pointer may point to a statically allocated instance of
5016 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5018 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5019 confused when opening/closing files between directory reads. So for example a
5020 program that reads the list of files on a disk, and after each call to
5021 <tt/readdir/, opens the file to process it, will fail.<newline>
5022 Possible solutions are reading the directory into memory before processing the
5023 file list, or to reset the directory by seeking to the correct position after
5024 opening/closing a file:
5026 seekdir (DIR, telldir (DIR));
5028 Platforms known to work without problems are: Apple.
5030 <tag/Availability/POSIX 1003.1
5032 <ref id="closedir" name="closedir">,
5033 <ref id="opendir" name="opendir">
5039 <sect1>realloc<label id="realloc"><p>
5043 <tag/Function/Change the size of an allocated memory block.
5044 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5045 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5046 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5047 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5048 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5049 behaves as if <tt/free/ had been called. On error (not enough memory
5050 available), <tt/realloc/ returns <tt/NULL/.
5051 <tag/Notes/<itemize>
5052 <item>The part of the memory block that is returned will have its contents
5054 <item>This function is somewhat dangerous to use. Be careful to save the
5055 pointer you're passing somewhere else, otherwise
5057 ptr = realloc (ptr, size);
5059 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5060 <item>The function is only available as fastcall function, so it may only
5061 be used in presence of a prototype.
5063 <tag/Availability/ISO 9899
5065 <ref id="_heapadd" name="_heapadd">,
5066 <ref id="_heapblocksize" name="_heapblocksize">,
5067 <ref id="_heapmaxavail" name="_heapmaxavail">,
5068 <ref id="_heapmemavail" name="_heapmemavail">,
5069 <ref id="calloc" name="calloc">,
5070 <ref id="free" name="free">,
5071 <ref id="realloc" name="realloc">
5077 <sect1>remove<label id="remove"><p>
5081 <tag/Function/Delete a file.
5082 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5083 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5084 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5085 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5086 code describing the reason for the failure.
5087 <tag/Notes/<itemize>
5088 <item>This function is not available on all cc65 targets (depends on the
5089 availability of file I/O).
5090 <item>The function is only available as fastcall function, so it may only
5091 be used in presence of a prototype.
5093 <tag/Availability/ISO 9899
5095 <ref id="rename" name="rename">,
5096 <ref id="unlink" name="unlink">
5099 #include <stdio.h>
5101 #define FILENAME "helloworld"
5103 if (remove (FILENAME) == 0) {
5104 printf ("We deleted %s successfully\n", FILENAME);
5106 printf ("There was a problem deleting %s\n", FILENAME);
5113 <sect1>rename<label id="rename"><p>
5117 <tag/Function/Rename a file.
5118 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5119 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5120 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5121 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5122 code describing the reason for the failure.
5123 <tag/Notes/<itemize>
5124 <item>This function is not available on all cc65 targets (depends on the
5125 capabilities of the storage devices).
5126 <item>The function is only available as fastcall function, so it may only
5127 be used in presence of a prototype.
5129 <tag/Availability/ISO 9899
5131 <ref id="remove" name="remove">
5134 #include <stdio.h>
5136 #define OLDNAME "textfile.txt"
5137 #define NEWNAME "textfile.bak"
5139 if (rename (OLDNAME, NEWNAME) == 0) {
5140 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5142 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5149 <sect1>reset_brk<label id="reset_brk"><p>
5153 <tag/Function/Resets the break vector to its original value.
5154 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5155 <tag/Declaration/<tt/void reset_brk (void);/
5156 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5157 before a call to <tt/set_brk/.
5158 <tag/Notes/<itemize>
5159 <item>The break vector is reset on program termination, so it's not strictly
5160 necessary to call this function as a part of your clean-up when exitting the program.
5162 <tag/Availability/cc65
5164 <ref id="reset_irq" name="reset_irq">,
5165 <ref id="set_brk" name="set_brk">,
5166 <ref id="set_irq" name="set_irq">
5172 <sect1>reset_irq<label id="reset_irq"><p>
5176 <tag/Function/Resets the C level interrupt request vector.
5177 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5178 <tag/Declaration/<tt/void reset_irq (void);/
5179 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5180 <tag/Notes/<itemize>
5181 <item>The interrupt vector is reset on program termination, so it's not strictly
5182 necessary to call this function as a part of your clean-up when exitting the program.
5184 <tag/Availability/cc65
5186 <ref id="reset_brk" name="reset_brk">,
5187 <ref id="set_brk" name="set_brk">,
5188 <ref id="set_irq" name="set_irq">
5194 <sect1>revers<label id="revers"><p>
5198 <tag/Function/Control revers character display.
5199 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5200 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5201 <tag/Description/If the argument is non zero, the function enables reverse
5202 character display. If the argument is zero, reverse character display is
5203 switched off. The old value of the setting is returned.
5204 <tag/Notes/<itemize>
5205 <item>The function may not be supported by the hardware, in which case
5206 the call is ignored.
5207 <item>The function is only available as fastcall function, so it may only
5208 be used in presence of a prototype.
5210 <tag/Availability/cc65
5212 <ref id="textcolor" name="textcolor">
5218 <sect1>rewinddir<label id="rewinddir"><p>
5222 <tag/Function/Reset a directory stream.
5223 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5224 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5225 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5226 pointed to by <tt/dir/ to the start of the directory.
5227 <tag/Notes/<itemize>
5228 <item>The function is only available as fastcall function, so it may only
5229 be used in presence of a prototype.
5231 <tag/Availability/POSIX 1003.1
5233 <ref id="seekdir" name="seekdir">,
5234 <ref id="telldir" name="telldir">
5240 <sect1>screensize<label id="screensize"><p>
5244 <tag/Function/Return the dimensions of the text mode screen.
5245 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5246 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5247 <tag/Description/The function returns the dimensions of the text mode screen.
5248 <tag/Notes/<itemize>
5249 <item>The function is only available as fastcall function, so it may only
5250 be used in presence of a prototype.
5252 <tag/Availability/cc65
5254 <ref id="gotox" name="gotox">,
5255 <ref id="gotoxy" name="gotoxy">,
5256 <ref id="gotoy" name="gotoy">,
5257 <ref id="wherex" name="wherex">,
5258 <ref id="wherey" name="wherey">
5264 <sect1>seekdir<label id="seekdir"><p>
5268 <tag/Function/Set the position of a directory stream.
5269 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5270 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5271 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5272 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5273 value returned by <tt/<ref id="telldir" name="telldir">/.
5274 <tag/Notes/<itemize>
5275 <item>The function is only available as fastcall function, so it may only
5276 be used in presence of a prototype.
5278 <tag/Availability/POSIX 1003.1
5280 <ref id="rewinddir" name="rewinddir">,
5281 <ref id="telldir" name="telldir">
5287 <sect1>ser_close<label id="ser_close"><p>
5291 <tag/Function/Close the port and disable interrupts
5292 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5293 <tag/Declaration/<tt/unsigned char ser_close (void);/
5294 <tag/Description/Close the port by clearing buffers and disable interrupts.
5295 <tag/Availability/cc65
5296 <tag/See also/Other serial functions.
5301 static void initialize(){
5302 struct ser_params params = {
5309 ser_install(lynx_comlynx); // This will activate the ComLynx
5311 ser_open(&params);
5318 <sect1>ser_get<label id="ser_get"><p>
5322 <tag/Function/Read a character from serial port.
5323 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5324 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5325 <tag/Description/Get a character from the serial port. If no characters are
5326 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5328 <tag/Notes/<itemize>
5329 <item>The function is only available as fastcall function, so it may only
5330 be used in presence of a prototype.
5332 <tag/Availability/cc65
5333 <tag/See also/Other serial functions.
5335 Wait for a character to be available from a serial port.
5338 while (ser_get(&ch) == SER_ERR_NO_DATA)
5345 <sect1>ser_install<label id="ser_install"><p>
5349 <tag/Function/Install an already loaded driver and return an error code.
5350 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5351 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5352 <tag/Description/The function installs a driver that was already loaded into
5353 memory (or linked statically to the program). It returns an error code
5354 (<tt/SER_ERR_OK/ in case of success).
5355 <tag/Notes/<itemize>
5356 <item>The function is only available as fastcall function, so it may only be
5357 used in presence of a prototype.
5359 <tag/Availability/cc65
5361 <ref id="ser_load_driver" name="ser_load_driver">,
5362 <ref id="ser_uninstall" name="ser_uninstall">,
5363 <ref id="ser_unload" name="ser_unload">
5365 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5371 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5375 <tag/Function/Platform dependent code extensions.
5376 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5377 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5378 <tag/Description/Some platforms have extra serial functions that are not
5379 supported by standard serial driver functions. You can extend the driver to support
5380 this extra functionality bt using ser_ioctl functions.
5381 <tag/Notes/<itemize>
5382 <item>The function is only available as fastcall function, so it may only
5383 be used in presence of a prototype.
5384 <item>These functions are not easily portable to other cc65 platforms.
5386 <tag/Availability/cc65
5387 <tag/See also/Other serial functions.
5392 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5396 <tag/Function/Load and install a serial driver.
5397 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5398 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5399 <tag/Description/Load and install the driver by name.
5400 Will just load the driver and check if loading was successful.
5401 <tag/Notes/<itemize>
5402 <item>The function is only available as fastcall function, so it may only
5403 be used in presence of a prototype.
5405 <tag/Availability/cc65
5406 <tag/See also/Other serial functions.
5412 <sect1>ser_open<label id="ser_open"><p>
5416 <tag/Function/Open the port by setting the port parameters and enable interrupts
5417 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5418 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5419 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5420 <tag/Notes/<itemize>
5421 <item>The function is only available as fastcall function, so it may only
5422 be used in presence of a prototype.
5424 <tag/Availability/cc65
5425 <tag/See also/Other serial functions.
5430 static void initialize(){
5431 struct ser_params params = {
5438 ser_install(lynx_comlynx); // This will activate the ComLynx
5440 ser_open(&params);
5447 <sect1>ser_put<label id="ser_put"><p>
5451 <tag/Function/Write a character to a serial port.
5452 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5453 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5454 <tag/Description/Send a character via the serial port. There is a transmit
5455 buffer, but transmitting is not done via interrupt. The function returns
5456 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5457 <tag/Notes/<itemize>
5458 <item>The function is only available as fastcall function, so it may only
5459 be used in presence of a prototype.
5461 <tag/Availability/cc65
5462 <tag/See also/Other serial functions.
5471 <sect1>ser_status<label id="ser_status"><p>
5475 <tag/Function/Return the serial port status.
5476 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5477 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5478 <tag/Description/Return the serial port status.
5479 <tag/Notes/<itemize>
5480 <item>The function is only available as fastcall function, so it may only
5481 be used in presence of a prototype.
5483 <tag/Availability/cc65
5484 <tag/See also/Other serial functions.
5490 <sect1>ser_uninstall<label id="ser_uninstall"><p>
5494 <tag/Function/Uninstall the currently loaded driver but do not unload it.
5495 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5496 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
5497 <tag/Description/Uninstall the currently loaded driver but do not unload it.
5498 <tag/Availability/cc65
5499 <tag/See also/Other serial functions.
5504 <sect1>ser_unload<label id="ser_unload"><p>
5508 <tag/Function/Uninstall, then unload the currently loaded driver.
5509 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5510 <tag/Declaration/<tt/unsigned char ser_unload (void);/
5511 <tag/Description/Uninstall, then unload the currently loaded driver.
5512 <tag/Availability/cc65
5513 <tag/See also/Other serial functions.
5519 <sect1>set_brk<label id="set_brk"><p>
5523 <tag/Function/Set the break vector to a user function.
5524 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5525 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
5526 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
5527 program code by letting the vector point to a user written C function. The
5528 runtime library installs a small stub that saves the registers into global
5529 variables that may be accessed (and changed) by the break handler.
5530 <tag/Notes/<itemize>
5531 <item>The function is only available as fastcall function, so it may only
5532 be used in presence of a prototype.
5533 <item>The stub saves the zero page registers used by the C runtime and switches
5534 to a small break handler stack. This means that it is safe to execute C code,
5535 even if C code was interrupted. Be careful however not to use too many local
5536 variables, and do not enable stack checks for the handler function or any other
5537 function called from it.
5538 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
5539 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
5540 otherwise the <tt/BRK/ instruction will get executed over and over again.
5541 <item>The break vector is reset on program termination, so it's not strictly
5542 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
5543 clean-up when exitting the program.
5545 <tag/Availability/cc65
5547 <ref id="reset_brk" name="reset_brk">
5553 <sect1>set_irq<label id="set_irq"><p>
5557 <tag/Function/Set the C level interrupt request vector to the given address.
5558 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5559 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
5560 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
5561 (IRQs) within the program code by letting the vector point to a user written C
5562 function. The runtime library installs a small stub that saves the zero page
5563 registers used by the C runtime before calling the handler function and restores
5564 them after the handler function returns. Additionally the stub temporarily switches
5565 the C runtime stack to the stack area provided as parameter. If the handler function
5566 was set up to handle a "private", "exclusive" interrupt request source it must
5567 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
5568 interrupt request actually stems from that source. In all other cases it must return
5569 the value <tt/IRQ_NOT_HANDLED/.
5570 <tag/Notes/<itemize>
5571 <item>The function is only available as fastcall function, so it may only
5572 be used in presence of a prototype.
5573 <item>The stub saves the registers and zero page locations used by the C runtime
5574 and switches to the provided stack area. As a consequence, there is some
5575 runtime overhead, but it it is safe to execute C code, even if other C code
5576 was interrupted. Be careful however not to call C library functions, and do not
5577 enable stack checks for the handler function or any other function called from
5579 <item>The interrupt vector is reset on program termination, so it's not strictly
5580 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
5581 clean-up when exitting the program.
5583 <tag/Availability/cc65
5585 <ref id="reset_brk" name="reset_brk">,
5586 <ref id="reset_irq" name="reset_irq">,
5587 <ref id="set_brk" name="set_brk">
5593 <sect1>setjmp<label id="setjmp"><p>
5597 <tag/Function/Save the context for use with <tt/longjmp/.
5598 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
5599 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
5600 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
5601 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
5603 <tag/Notes/<itemize>
5604 <item>The function is only available as fastcall function, so it may only
5605 be used in presence of a prototype.
5606 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
5607 <item><tt/setjmp/ will not save the signal context.
5609 <tag/Availability/ISO 9899
5611 <ref id="longjmp" name="longjmp">
5617 <sect1>setlocale<label id="setlocale"><p>
5621 <tag/Function/Selects a locale.
5622 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
5623 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
5624 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
5625 <tag/Notes/<itemize>
5626 <item>The function is only available as fastcall function, so it may only
5627 be used in presence of a prototype.
5628 <item>cc65 supports only the "C" locale, so calling this function to set a
5629 different locale has no effect.
5631 <tag/Availability/ISO 9899
5633 <ref id="localeconv" name="localeconv">,
5634 <ref id="strcoll" name="strcoll">
5635 <ref id="strxfrm" name="strxfrm">
5641 <sect1>signal<label id="signal"><p>
5645 <tag/Function/Install a signal handler.
5646 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5647 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
5648 <tag/Description/<tt/signal/ installs a handler for the given signal. The
5649 handler may either be a user supplied function, or one of the predefined
5650 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
5651 previous value if the signal , or the special function vector SIG_ERR in
5653 <tag/Notes/<itemize>
5654 <item>The function is only available as fastcall function, so it may only
5655 be used in presence of a prototype.
5657 <tag/Availability/ISO 9899
5659 <ref id="abort" name="abort">,
5660 <ref id="raise" name="raise">
5666 <sect1>sleep<label id="sleep"><p>
5670 <tag/Function/Sleep for a specified amount of time.
5671 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
5672 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
5673 <tag/Description/The function will return after the specified number of
5674 seconds have elapsed.
5675 <tag/Notes/<itemize>
5676 <item>The function is only available as fastcall function, so it may only
5677 be used in presence of a prototype.
5679 <tag/Availability/POSIX 1003.1
5685 <sect1>slow<label id="slow"><p>
5689 <tag/Function/Switch the C128 into 1MHz mode.
5690 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
5691 <tag/Declaration/<tt/void slow (void);/
5692 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
5693 will halve the speed compared to fast mode.
5694 <tag/Notes/<itemize>
5695 <item>The function is specific to the C128.
5697 <tag/Availability/C128
5699 <ref id="fast" name="fast">,
5700 <ref id="toggle_videomode" name="toggle_videomode">,
5701 <ref id="videomode" name="videomode">
5707 <sect1>srand<label id="srand"><p>
5711 <tag/Function/Initialize the pseudo random number generator.
5712 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5713 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
5714 <tag/Description/The function initializes the random number generator using
5715 the given seed. On program startup, the generator behaves as if <tt/srand/ has
5716 been called with an argument of 1.
5717 <tag/Notes/<itemize>
5718 <item>The function is only available as fastcall function, so it may only
5719 be used in presence of a prototype.
5721 <tag/Availability/ISO 9899
5723 <ref id="_randomize" name="_randomize">,
5724 <ref id="rand" name="rand">
5730 <sect1>strcasecmp<label id="strcasecmp"><p>
5734 <tag/Function/Compare two strings case insensitive.
5735 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5736 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
5737 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
5738 as parameters without case sensitivity. It returns a value that is less than
5739 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
5740 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
5741 <tag/Notes/<itemize>
5742 <item>The function is only available as fastcall function, so it may only
5743 be used in presence of a prototype.
5744 <item>The function is not available in strict ANSI mode.
5746 <tag/Availability/cc65
5748 <ref id="strcmp" name="strcmp">,
5749 <ref id="strcoll" name="strcoll">,
5750 <ref id="stricmp" name="stricmp">,
5751 <ref id="strncmp" name="strncmp">,
5752 <ref id="strxfrm" name="strxfrm">
5758 <sect1>strcat<label id="strcat"><p>
5762 <tag/Function/Concatentate two strings.
5763 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5764 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
5765 <tag/Description/The <tt/strcat/ function appends a copy of the string
5766 pointed to by s2 (including the terminating null byte) to the end of the
5767 string pointed to by s1. The initial byte of s2 overwrites the null byte at
5769 <tag/Notes/<itemize>
5770 <item>The function is only available as fastcall function, so it may only
5771 be used in presence of a prototype.
5772 <item>If copying takes place between objects that overlap, the behaviour
5775 <tag/Availability/ISO 9899
5777 <ref id="strcpy" name="strcpy">,
5778 <ref id="strncat" name="strncat">,
5779 <ref id="strncpy" name="strncpy">
5785 <sect1>strchr<label id="strchr"><p>
5789 <tag/Function/Search for a character in a string.
5790 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5791 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
5792 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
5793 (converted to a char) in the string pointed to by <tt/s/. The terminating null
5794 byte is considered to be part of the string. Upon completion, the function
5795 returns a pointer to the byte, or a null pointer if the byte was not found.
5796 <tag/Notes/<itemize>
5797 <item>The function is only available as fastcall function, so it may only
5798 be used in presence of a prototype.
5800 <tag/Availability/ISO 9899
5802 <ref id="memchr" name="memchr">,
5803 <ref id="strrchr" name="strrchr">
5809 <sect1>strcmp<label id="strcmp"><p>
5813 <tag/Function/Compare two strings.
5814 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5815 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
5816 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
5817 parameters. It returns a value that is less than zero if <tt/s1/ is less than
5818 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
5819 if <tt/s1/ is greater than <tt/s2/.
5820 <tag/Notes/<itemize>
5821 <item>The function is only available as fastcall function, so it may only
5822 be used in presence of a prototype.
5824 <tag/Availability/ISO 9899
5826 <ref id="strcasecmp" name="strcasecmp">,
5827 <ref id="strcoll" name="strcoll">,
5828 <ref id="stricmp" name="stricmp">,
5829 <ref id="strncmp" name="strncmp">
5830 <ref id="strxfrm" name="strxfrm">
5836 <sect1>strcoll<label id="strcoll"><p>
5840 <tag/Function/Compare two strings.
5841 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5842 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
5843 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
5844 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
5845 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
5846 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
5847 than zero if <tt/s1/ is greater than <tt/s2/.
5848 <tag/Notes/<itemize>
5849 <item>The function is only available as fastcall function, so it may only
5850 be used in presence of a prototype.
5852 <tag/Availability/ISO 9899
5854 <ref id="setlocale" name="setlocale">,
5855 <ref id="strcasecmp" name="strcasecmp">,
5856 <ref id="strcmp" name="strcmp">,
5857 <ref id="stricmp" name="stricmp">,
5858 <ref id="strncmp" name="strncmp">,
5859 <ref id="strxfrm" name="strxfrm">
5865 <sect1>strcpy<label id="strcpy"><p>
5869 <tag/Function/Copy a string.
5870 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5871 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
5872 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
5873 <tt/s2/ (including the terminating null byte) into the array pointed to by
5874 <tt/s1/. The function will always return <tt/s1/.
5875 <tag/Notes/<itemize>
5876 <item>The function is only available as fastcall function, so it may only
5877 be used in presence of a prototype.
5878 <item>If copying takes place between objects that overlap, the behaviour
5881 <tag/Availability/ISO 9899
5883 <ref id="strcat" name="strcat">,
5884 <ref id="strncat" name="strncat">,
5885 <ref id="strncpy" name="strncpy">
5888 #include <string.h>
5890 static char hello[14];
5892 strcpy (hello, "Hello world!\n");
5898 <sect1>strcspn<label id="strcspn"><p>
5902 <tag/Function/Compute the length of a substring.
5903 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5904 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
5905 <tag/Description/The <tt/strcspn/ function computes and returns the length of
5906 the substring pointed to by <tt/s/ which does <em>not</em> consist of
5907 characters contained in the string <tt/set/.
5908 <tag/Notes/<itemize>
5909 <item>The function is only available as fastcall function, so it may only
5910 be used in presence of a prototype.
5912 <tag/Availability/ISO 9899
5914 <ref id="strqtok" name="strqtok">,
5915 <ref id="strspn" name="strspn">,
5916 <ref id="strstr" name="strstr">,
5917 <ref id="strtok" name="strtok">
5923 <sect1>strdup<label id="strdup"><p>
5927 <tag/Function/Allocate a copy of a string on the heap.
5928 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5929 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
5930 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
5931 to hold a copy of <tt/s/ including the terminating zero. If the allocation
5932 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
5933 memory block, and a pointer to the block is returned.
5934 <tag/Notes/<itemize>
5935 <item>The function is only available as fastcall function, so it may only
5936 be used in presence of a prototype.
5937 <item>It is up to the caller to free the allocated memory block.
5939 <tag/Availability/ISO 9899
5941 <ref id="free" name="free">,
5942 <ref id="malloc" name="malloc">
5948 <sect1>strerror<label id="strerror"><p>
5952 <tag/Function/Return a string describing an error code.
5953 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5954 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
5955 <tag/Description/The <tt/strerror/ function returns a string describing the
5956 given error code. If an invalid error code is passed, the string "Unknown
5957 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
5958 <tt/errno/ is left untouched.
5959 <tag/Notes/<itemize>
5960 <item>The function is only available as fastcall function, so it may only
5961 be used in presence of a prototype.
5962 <item>While the return type of the function is a <tt/char*/, the returned
5963 string must not be modified by the caller!
5965 <tag/Availability/ISO 9899
5967 <ref id="_stroserror" name="_stroserror">
5973 <sect1>stricmp<label id="stricmp"><p>
5977 <tag/Function/Compare two strings case insensitive.
5978 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5979 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
5980 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
5981 parameters without case sensitivity. It returns a value that is less than zero
5982 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
5983 value greater than zero if <tt/s1/ is greater than <tt/s2/.
5984 <tag/Notes/<itemize>
5985 <item>The function is only available as fastcall function, so it may only
5986 be used in presence of a prototype.
5987 <item>The function is not available in strict ANSI mode.
5989 <tag/Availability/cc65
5991 <ref id="strcasecmp" name="strcasecmp">,
5992 <ref id="strcmp" name="strcmp">,
5993 <ref id="strcoll" name="strcoll">,
5994 <ref id="strncmp" name="strncmp">,
5995 <ref id="strxfrm" name="strxfrm">
6001 <sect1>strlen<label id="strlen"><p>
6005 <tag/Function/Return the length of a string.
6006 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6007 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6008 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6009 string to which s points, not including the terminating null byte.
6010 <tag/Notes/<itemize>
6011 <item>The function is only available as fastcall function, so it may only
6012 be used in presence of a prototype.
6013 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6014 function does not work correctly for strings with more than 255 characters.
6016 <tag/Availability/ISO 9899
6018 <ref id="strcpy" name="strcpy">
6024 <sect1>strlower<label id="strlower"><p>
6028 <tag/Function/Make a string lower case.
6029 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6030 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6031 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6032 function to each character of a string. The function will always return <tt/s/.
6033 <tag/Notes/<itemize>
6034 <item>The function is only available as fastcall function, so it may only
6035 be used in presence of a prototype.
6036 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6037 <item>An alias name for this function is <tt/strlwr/.
6039 <tag/Availability/cc65
6041 <ref id="strupper" name="strupper">,
6042 <ref id="tolower" name="tolower">
6048 <sect1>strlwr<label id="strlwr"><p>
6055 <sect1>strncat<label id="strncat"><p>
6059 <tag/Function/Concatentate two strings.
6060 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6061 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6062 <tag/Description/The <tt/strncat/ function appends not more than n characters
6063 of the string pointed to by s2 to the end of the string pointed to by s1. The
6064 terminating null character at the end of s1 is overwritten. A terminating null
6065 character is appended to the result, even if not all of s2 is appended to s1.
6066 <tag/Notes/<itemize>
6067 <item>The function is only available as fastcall function, so it may only
6068 be used in presence of a prototype.
6069 <item>If copying takes place between objects that overlap, the behaviour
6072 <tag/Availability/ISO 9899
6074 <ref id="strcpy" name="strcpy">,
6075 <ref id="strncat" name="strncat">,
6076 <ref id="strncpy" name="strncpy">
6082 <sect1>strncmp<label id="strncmp"><p>
6086 <tag/Function/Compare two strings.
6087 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6088 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6089 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6090 characters of the two strings passed as parameters. It returns a value that is
6091 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6092 <tt/s2/, zero if they are identical, and a value greater than zero they are
6094 <tag/Notes/<itemize>
6095 <item>The function is only available as fastcall function, so it may only
6096 be used in presence of a prototype.
6098 <tag/Availability/ISO 9899
6100 <ref id="strcasecmp" name="strcasecmp">,
6101 <ref id="strcmp" name="strcmp">,
6102 <ref id="strcoll" name="strcoll">,
6103 <ref id="stricmp" name="stricmp">,
6104 <ref id="strxfrm" name="strxfrm">
6110 <sect1>strncpy<label id="strncpy"><p>
6114 <tag/Function/Copy part of a string.
6115 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6116 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6117 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6118 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6119 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6120 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6121 written. The function always will return <tt/s1/.
6122 <tag/Notes/<itemize>
6123 <item>The function is available only as a fastcall function; so, it may be used
6124 only in the presence of a prototype.
6125 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6126 to by <tt/s2/, the result is <em/not/ null-terminated!
6127 <item>If copying takes place between objects that overlap, the behaviour is
6130 <tag/Availability/ISO 9899
6132 <ref id="memcpy" name="memcpy">,
6133 <ref id="strcat" name="strcat">,
6134 <ref id="strcpy" name="strcpy">,
6135 <ref id="strncat" name="strncat">
6140 static char hello[6];
6142 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6148 <sect1>strqtok<label id="strqtok"><p>
6152 <tag/Function/Break a string into tokens.
6153 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6154 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6155 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6156 tokens, which are delimited by either quotation marks or characters from the
6157 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6158 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6159 pointer to the first token in the string <tt/s1/. The following calls must pass
6160 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6161 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6162 <tag/Notes/<itemize>
6163 <item>The function is available only as a fastcall function; so, it may be used
6164 only in the presence of a prototype.
6165 <item><tt/strqtok()/ will modify the string <tt/s1/.
6166 <item>The function will forget where it is in the <tt/s1/ string if it is given
6167 a second <tt/s1/ string before it finishes the first one.
6169 <tag/Availability/cc65
6171 <ref id="strcspn" name="strcspn">,
6172 <!-- <ref id="strpbrk" name="strpbrk">, -->
6173 <ref id="strspn" name="strspn">,
6174 <ref id="strtok" name="strtok">
6180 <sect1>strrchr<label id="strrchr"><p>
6184 <tag/Function/Search for a character in a string.
6185 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6186 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6187 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6188 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6189 byte is considered to be part of the string. Upon completion, the function
6190 returns a pointer to the byte, or a null pointer if the byte was not found.
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.
6195 <tag/Availability/ISO 9899
6197 <ref id="strchr" name="strchr">
6203 <sect1>strspn<label id="strspn"><p>
6207 <tag/Function/Compute the length of a substring.
6208 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6209 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6210 <tag/Description/The <tt/strspn/ function computes and returns the length of
6211 the substring pointed to by <tt/s/ which does consist only of characters
6212 contained in the string <tt/set/.
6213 <tag/Notes/<itemize>
6214 <item>The function is only available as fastcall function, so it may only
6215 be used in presence of a prototype.
6217 <tag/Availability/ISO 9899
6219 <ref id="strcspn" name="strcspn">,
6220 <ref id="strstr" name="strstr">
6226 <sect1>strstr<label id="strstr"><p>
6230 <tag/Function/Find a substring.
6231 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6232 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6233 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6234 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6235 otherwise it returns <tt/NULL/.
6236 <tag/Notes/<itemize>
6237 <item>The function is only available as fastcall function, so it may only
6238 be used in presence of a prototype.
6240 <tag/Availability/ISO 9899
6242 <ref id="strcspn" name="strcspn">,
6243 <ref id="strspn" name="strspn">
6249 <sect1>strtok<label id="strtok"><p>
6253 <tag/Function/Break a string into tokens.
6254 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6255 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6256 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6257 tokens, which are delimited by characters from the string <tt/s2/. The first call
6258 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6259 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6260 the next token in the string. Different sets of delimiters may be used for the
6261 subsequent calls to <tt/strtok()/.
6262 <tag/Notes/<itemize>
6263 <item>The function is only available as fastcall function, so it may only
6264 be used in presence of a prototype.
6265 <item><tt/strtok()/ will modify the string <tt/s1/.
6266 <item>The function will forget where it is in the <tt/s1/ string if it is given
6267 a second <tt/s1/ string before it finishes the first one.
6269 <tag/Availability/ISO 9899
6271 <ref id="strcspn" name="strcspn">,
6272 <!-- <ref id="strpbrk" name="strpbrk">, -->
6273 <ref id="strqtok" name="strqtok">,
6274 <ref id="strspn" name="strspn">
6280 <sect1>strxfrm<label id="strxfrm"><p>
6284 <tag/Function/Transform a string.
6285 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6286 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6287 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6288 s2 and places the resulting string into the string pointed to by s1. The
6289 transformation is such that if the <tt/strcmp/ function is applied to two
6290 transformed strings, it returns a value greater than, equal to, or less than
6291 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6292 same two original strings. No more than n characters are placed into the
6293 resulting array pointed to by s1, including the terminating null character.
6294 <tag/Notes/<itemize>
6295 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6296 the behaviour is undefined.
6297 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6298 <item>The function is only available as fastcall function, so it may only
6299 be used in presence of a prototype.
6300 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6301 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6303 <tag/Availability/ISO 9899
6305 <ref id="strcmp" name="strcmp">,
6306 <ref id="strcoll" name="strcoll">,
6307 <ref id="strncpy" name="strncpy">
6313 <sect1>strupper<label id="strupper"><p>
6317 <tag/Function/Make a string upper case.
6318 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6319 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6320 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6321 function to each character of a string. The function will always return <tt/s/.
6322 <tag/Notes/<itemize>
6323 <item>The function is only available as fastcall function, so it may only
6324 be used in presence of a prototype.
6325 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6326 <item>An alias name for this function is <tt/strupr/.
6328 <tag/Availability/cc65
6330 <ref id="strlower" name="strlower">
6331 <ref id="toupper" name="toupper">
6337 <sect1>strupr<label id="strupr"><p>
6344 <sect1>telldir<label id="telldir"><p>
6348 <tag/Function/Return the current position of a directory stream.
6349 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6350 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6351 <tag/Description/<tt/telldir/ returns the current position of a directory
6352 stream. The return value may be used in subsequent calls to
6353 <tt/<ref id="seekdir" name="seekdir">/.
6354 <tag/Notes/<itemize>
6355 <item>The function is only available as fastcall function, so it may only
6356 be used in presence of a prototype.
6358 <tag/Availability/POSIX 1003.1
6360 <ref id="seekdir" name="seekdir">,
6361 <ref id="telldir" name="telldir">
6367 <sect1>textcolor<label id="textcolor"><p>
6371 <tag/Function/Set the text color.
6372 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6373 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6374 <tag/Description/The function will set a new text color. It returns the old
6375 (current) text color. Text output using any <tt/conio.h/ function will use
6376 the color set by this function.
6377 <tag/Notes/<itemize>
6378 <item>Text colors are system dependent. The function may have no effect
6379 on systems where the text color cannot be changed.
6380 <item>The function is only available as fastcall function, so it may only
6381 be used in presence of a prototype.
6383 <tag/Availability/cc65
6385 <ref id="bgcolor" name="bgcolor">,
6386 <ref id="bordercolor" name="bordercolor">
6392 <sect1>tgi_arc<label id="tgi_arc"><p>
6396 <tag/Function/Draw an elliptic arc in the current color.
6397 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6398 <tag/Declaration/<tt/void __fastcall__ tgi_arc (int x, int y,
6399 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
6400 <tag/Description/The function draws an elliptic arc with center at x/y and
6401 radii rx/ry using the current drawing color. The arc covers the angle
6402 between sa and ea (startangle and endangle), which must be in the range
6404 <tag/Notes/<itemize>
6405 <item>The function is only available as fastcall function, so it may only
6406 be used in presence of a prototype.
6407 <item>The function behaves unexpectedly or may crash if the angles are out
6410 <tag/Availability/cc65
6412 <ref id="tgi_bar" name="tgi_bar">,
6413 <ref id="tgi_circle" name="tgi_circle">,
6414 <ref id="tgi_ellipse" name="tgi_ellipse">,
6415 <ref id="tgi_pieslice" name="tgi_pieslice">,
6416 <ref id="tgi_setcolor" name="tgi_setcolor">
6418 /* Draw the upper half of an ellipse */
6419 tgi_setcolor(TGI_COLOR_BLUE);
6420 tgi_arc (50, 50, 40, 20, 0, 180);
6426 <sect1>tgi_bar<label id="tgi_bar"><p>
6430 <tag/Function/The function fills a rectangle on the drawpage with the current
6432 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6433 <tag/Declaration/<tt/void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);/
6434 <tag/Description/The function fills a rectangle on the drawpage with the current
6436 <tag/Notes/<itemize>
6437 <item>The function is only available as fastcall function, so it may only
6438 be used in presence of a prototype.
6440 <tag/Availability/cc65
6441 <tag/See also/Other tgi function
6443 tgi_setcolor(TGI_COLOR_GREEN);
6444 tgi_bar(10, 10, 100, 60);
6450 <sect1>tgi_circle<label id="tgi_circle"><p>
6454 <tag/Function/The function draws a circle in the current color.
6455 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6456 <tag/Declaration/<tt/void __fastcall__ tgi_circle (int x, int y, unsigned char radius);/
6457 <tag/Description/The function draws a circle in the current color.
6458 <tag/Notes/<itemize>
6459 <item>The function is only available as fastcall function, so it may only
6460 be used in presence of a prototype.
6462 <tag/Availability/cc65
6464 <ref id="tgi_arc" name="tgi_arc">,
6465 <ref id="tgi_bar" name="tgi_bar">,
6466 <ref id="tgi_ellipse" name="tgi_ellipse">,
6467 <ref id="tgi_pieslice" name="tgi_pieslice">,
6468 <ref id="tgi_setcolor" name="tgi_setcolor">
6470 tgi_setcolor(TGI_COLOR_BLACK);
6471 tgi_circle(50, 40, 40);
6477 <sect1>tgi_clear<label id="tgi_clear"><p>
6481 <tag/Function/Clear the drawpage
6482 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6483 <tag/Declaration/<tt/void tgi_clear (void);/
6484 <tag/Description/Clear the drawpage
6485 <tag/Availability/cc65
6486 <tag/See also/Other tgi functions
6492 <sect1>tgi_done<label id="tgi_done"><p>
6496 <tag/Function/End graphics mode, switch back to text mode.
6497 Will NOT uninstall or unload the driver!
6498 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6499 <tag/Declaration/<tt/void tgi_done (void);/
6500 <tag/Description/End graphics mode, switch back to text mode.
6501 Will NOT uninstall or unload the driver!
6502 <tag/Availability/cc65
6503 <tag/See also/Other tgi functions
6509 <sect1>tgi_ellipse<label id="tgi_ellipse"><p>
6513 <tag/Function/The function draws an ellipse in the current color.
6514 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6515 <tag/Declaration/<tt/void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);/
6516 <tag/Description/The function draws an ellipse at position x/y with radii
6517 rx and ry, using the current drawing color.
6518 <tag/Notes/<itemize>
6519 <item>The function is only available as fastcall function, so it may only
6520 be used in presence of a prototype.
6522 <tag/Availability/cc65
6524 <ref id="tgi_arc" name="tgi_arc">,
6525 <ref id="tgi_bar" name="tgi_bar">,
6526 <ref id="tgi_circle" name="tgi_circle">,
6527 <ref id="tgi_pieslice" name="tgi_pieslice">,
6528 <ref id="tgi_setcolor" name="tgi_setcolor">
6530 tgi_setcolor(TGI_COLOR_RED);
6531 tgi_ellipse (50, 40, 40, 20);
6537 <sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p>
6541 <tag/Function/Free a vector font that was previously loaded into memory.
6542 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6543 <tag/Declaration/<tt/void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);/
6544 <tag/Description/Free a vector font that was previously loaded into memory.
6545 <tag/Notes/<itemize>
6546 <item>The function is only available as fastcall function, so it may only
6547 be used in presence of a prototype.
6549 <tag/Availability/cc65
6551 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6552 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
6558 <sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p>
6560 <quote> <descrip> <tag/Function/Return the pixel aspect ratio.
6561 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6562 <tag/Declaration/<tt/unsigned tgi_getaspectratio (void);/
6563 <tag/Description/The function returns the pixel aspect ratio for the current
6564 driver and display as an 8.8 fixed point value. It may be used to correct
6565 geometric shapes so they look correct on the display. As an example, a circle
6566 with a radius of 100 pixels may look elliptic on some driver/display
6567 combinations if the aspect ratio is not 1.00.
6568 <tag/Notes/<itemize>
6569 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
6570 monitor for the given platform. The aspect ratio may be wrong if another
6572 <item>No TGI function will use the aspect ratio. It is up to the programmer to
6574 <item>The <ref id="tgi_setaspectratio" name="tgi_setaspectratio"> function can
6575 be used to change the aspect ratio for a loaded driver. The value is not reset
6576 by <ref id="tgi_init" name="tgi_init">, so if a driver is linked statically to
6577 an application, switching into and out of graphics mode will not restore the
6578 original aspect ratio.
6580 <tag/Availability/cc65
6582 <ref id="tgi_setaspectratio" name="tgi_setaspectratio">
6588 <sect1>tgi_getcolor<label id="tgi_getcolor"><p>
6592 <tag/Function/Return the current drawing color.
6593 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6594 <tag/Declaration/<tt/unsigned char tgi_getcolor (void);/
6595 <tag/Description/The actual color is an index to a palette. During tgi_init
6596 you will get a default palette. The number of colors depend on the platform.
6597 All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some
6598 platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN
6599 and then you change the green of the palette to blue using tgi_setpalette then
6600 after this painting in TGI_COLOR_GREEN will actually be blue.
6601 <tag/Availability/cc65
6602 <tag/See also/Other tgi functions
6604 color = tgi_getcolor();
6610 <sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p>
6614 <tag/Function/Get the number of available colors.
6615 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6616 <tag/Declaration/<tt/unsigned char tgi_getcolorcount (void);/
6617 <tag/Description/Tgi platforms use indexed color palettes. This function
6618 returns the number of entries we can use in the palette.
6619 <tag/Availability/cc65
6620 <tag/See also/Other tgi functions
6622 if (tgi_getcolorcount() == 2) {
6623 printf("Only monochrome graphics is supported\n");
6630 <sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p>
6634 <tag/Function/Get the palette installed by default.
6635 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6636 <tag/Declaration/<tt/const unsigned char* tgi_getdefpalette (void);/
6637 <tag/Description/The tgi driver has a default palette that is active at startup.
6638 The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this
6639 palette to work correctly.
6640 <tag/Availability/cc65
6641 <tag/See also/Other tgi functions
6647 <sect1>tgi_geterror<label id="tgi_geterror"><p>
6651 <tag/Function/Return the error code for the last operation.
6652 This will also clear the error.
6653 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6654 <tag/Declaration/<tt/unsigned char tgi_geterror (void);/
6655 <tag/Description/Return the error code for the last operation.
6656 This will also clear the error.
6657 <tag/Availability/cc65
6658 <tag/See also/Other tgi functions
6664 <sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p>
6668 <tag/Function/Get an error message describing the error.
6669 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6670 <tag/Declaration/<tt/const char* __fastcall__ tgi_geterrormsg (unsigned char code);/
6671 <tag/Description/Get an error message describing the error.
6672 <tag/Notes/<itemize>
6673 <item>The function is only available as fastcall function, so it may only
6674 be used in presence of a prototype.
6676 <tag/Availability/cc65
6677 <tag/See also/Other tgi functions
6683 <sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p>
6687 <tag/Function/Get the highest index of the palette.
6688 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6689 <tag/Declaration/<tt/unsigned char tgi_getmaxcolor (void);/
6690 <tag/Description/Get the highest index of the palette.
6691 <tag/Availability/cc65
6692 <tag/See also/Other tgi functions
6698 <sect1>tgi_getmaxx<label id="tgi_getmaxx"><p>
6702 <tag/Function/Get the maximum x coordinate that can be used on this screen.
6703 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6704 <tag/Declaration/<tt/unsigned tgi_getmaxx (void);/
6705 <tag/Description/Get the maximum x coordinate that can be used on this screen.
6706 <tag/Availability/cc65
6707 <tag/See also/Other tgi functions
6713 <sect1>tgi_getmaxy<label id="tgi_getmaxy"><p>
6717 <tag/Function/Get the maximum y coordinate that can be used on this screen.
6718 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6719 <tag/Declaration/<tt/unsigned tgi_getmaxy (void);/
6720 <tag/Description/Get the maximum y coordinate that can be used on this screen.
6721 <tag/Availability/cc65
6722 <tag/See also/Other tgi functions
6728 <sect1>tgi_getpagecount<label id="tgi_getpagecount"><p>
6732 <tag/Function/Return the number of screen pages available.
6733 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6734 <tag/Declaration/<tt/unsigned tgi_getpagecount (void);/
6735 <tag/Description/Return the number of screen pages available.
6736 <tag/Availability/cc65
6738 <ref id="tgi_setdrawpage" name="tgi_setdrawpage">,
6739 <ref id="tgi_setviewpage" name="tgi_setviewpage">
6745 <sect1>tgi_getpalette<label id="tgi_getpalette"><p>
6749 <tag/Function/Get the palette installed.
6750 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6751 <tag/Declaration/<tt/const unsigned char* tgi_getpalette (void);/
6752 <tag/Description/Get the palette installed.
6753 <tag/Availability/cc65
6754 <tag/See also/Other tgi functions
6760 <sect1>tgi_getpixel<label id="tgi_getpixel"><p>
6764 <tag/Function/Get the color of a pixel from the viewpage.
6765 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6766 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/
6767 <tag/Description/Get the color of a pixel from the viewpage.
6768 <tag/Notes/<itemize>
6769 <item>The function is only available as fastcall function, so it may only
6770 be used in presence of a prototype.
6772 <tag/Availability/cc65
6773 <tag/See also/Other tgi functions.
6779 <sect1>tgi_getxres<label id="tgi_getxres"><p>
6783 <tag/Function/Get number of horisontal pixels on the screen.
6784 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6785 <tag/Declaration/<tt/unsigned tgi_getxres (void);/
6786 <tag/Description/Get number of horisontal pixels on the screen.
6787 This is same as tgi_maxx()+1.
6788 <tag/Availability/cc65
6789 <tag/See also/Other tgi functions.
6795 <sect1>tgi_getyres<label id="tgi_getyres"><p>
6799 <tag/Function/Get number of vertical pixels on the screen.
6800 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6801 <tag/Declaration/<tt/unsigned tgi_getyres (void);/
6802 <tag/Description/Get number of vertical pixels on the screen.
6803 This is same as tgi_maxy()+1.
6804 <tag/Availability/cc65
6805 <tag/See also/Other tgi functions.
6811 <sect1>tgi_gotoxy<label id="tgi_gotoxy"><p>
6815 <tag/Function/Set graphics cursor at x, y.
6816 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6817 <tag/Declaration/<tt/void __fastcall__ tgi_gotoxy (int x, int y);/
6818 <tag/Description/Set graphics cursor at x, y.
6819 <tag/Notes/<itemize>
6820 <item>The function is only available as fastcall function, so it may only
6821 be used in presence of a prototype.
6823 <tag/Availability/cc65
6824 <tag/See also/Other tgi functions.
6830 <sect1>tgi_init<label id="tgi_init"><p>
6834 <tag/Function/Initialize the already loaded graphics driver.
6835 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6836 <tag/Declaration/<tt/void tgi_init (void);/
6837 <tag/Description/The tgi_init function will set the default palette to the
6839 <tag/Notes/<itemize>
6840 <item><tt/tgi_init/ will not clear the screen. This allows switching between
6841 text and graphics mode on platforms that have separate memory areas for the
6842 screens. If you want the screen cleared, call <tt/<ref id="tgi_clear"
6843 name="tgi_clear">/ after <tt/tgi_init/.
6845 <tag/Availability/cc65
6846 <tag/See also/Other tgi functions.
6848 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6849 tgi_init(); //Set up the default palette and clear the screen.
6855 <sect1>tgi_install<label id="tgi_install"><p>
6859 <tag/Function/Install an already loaded driver and return an error code.
6860 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6861 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_install (void* driver);/
6862 <tag/Description/The function installs a driver that was already loaded into
6863 memory (or linked statically to the program). It returns an error code
6864 (<tt/TGI_ERR_OK/ in case of success).
6865 <tag/Notes/<itemize>
6866 <item>The function is only available as fastcall function, so it may only be
6867 used in presence of a prototype.
6869 <tag/Availability/cc65
6871 <ref id="tgi_load_driver" name="tgi_load_driver">,
6872 <ref id="tgi_uninstall" name="tgi_uninstall">,
6873 <ref id="tgi_unload" name="tgi_unload">
6875 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6876 tgi_init(); //Set up the default palette and clear the screen.
6882 <sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p>
6886 <tag/Function/Install an already loaded driver and return an error code.
6887 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6888 <tag/Declaration/<tt/void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);/
6890 Install a vector font for use. More than one vector font can be loaded,
6891 but only one can be active. This function is used to tell which one. Call
6892 with a NULL pointer to uninstall the currently installed font.
6893 <tag/Notes/<itemize>
6894 <item>The function is only available as fastcall function, so it may only be
6895 used in presence of a prototype.
6897 <tag/Availability/cc65
6899 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6900 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
6906 <sect1>tgi_ioctl<label id="tgi_ioctl"><p>
6910 <tag/Function/Platform dependent code extensions.
6911 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6912 <tag/Declaration/<tt/unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);/
6913 <tag/Description/Some platforms have extra display hardware that is not
6914 supported by standard tgi functions. You can extend the driver to support
6915 this extra hardware using tgi_ioctl functions.
6916 <tag/Notes/<itemize>
6917 <item>The function is only available as fastcall function, so it may only
6918 be used in presence of a prototype.
6919 <item>These functions are not easily portable to other cc65 platforms.
6921 <tag/Availability/cc65
6922 <tag/See also/Other tgi functions.
6924 #define tgi_sprite(spr) tgi_ioctl(0, (void*)(spr))
6925 #define tgi_flip() tgi_ioctl(1, (void*)0)
6926 #define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
6927 #define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
6928 #define tgi_busy() tgi_ioctl(4, (void*)0)
6929 #define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
6931 tgi_sprite(&background);
6932 tgi_setcolor(TGI_COLOR_BLUE);
6933 tgi_outttextxy(20,40,"Hello World");
6934 tgi_updatedisplay();
6941 <sect1>tgi_line<label id="tgi_line"><p>
6945 <tag/Function/Draw a line in the current drawing color.
6946 The graphics cursor will be set to x2/y2 by this call.
6947 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6948 <tag/Declaration/<tt/void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);/
6949 <tag/Description/Draw a line in the current drawing color.
6950 The graphics cursor will be set to x2/y2 by this call.
6951 <tag/Notes/<itemize>
6952 <item>The function is only available as fastcall function, so it may only
6953 be used in presence of a prototype.
6955 <tag/Availability/cc65
6956 <tag/See also/Other tgi functions.
6962 <sect1>tgi_lineto<label id="tgi_lineto"><p>
6966 <tag/Function/Draw a line in the current drawing color from the graphics
6967 cursor to the new end point. The graphics cursor will be updated to x2/y2.
6968 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6969 <tag/Declaration/<tt/void __fastcall__ tgi_lineto (int x2, int y2);/
6970 <tag/Description/Draw a line in the current drawing color from the graphics
6971 cursor to the new end point. The graphics cursor will be updated to x2/y2.
6972 <tag/Notes/<itemize>
6973 <item>The function is only available as fastcall function, so it may only
6974 be used in presence of a prototype.
6976 <tag/Availability/cc65
6977 <tag/See also/Other tgi functions.
6983 <sect1>tgi_load_driver<label id="tgi_load_driver"><p>
6987 <tag/Function/Load and install the given driver.
6988 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6989 <tag/Declaration/<tt/void __fastcall__ tgi_load_driver (const char *name);/
6990 <tag/Description/Load and install the driver by name.
6991 Will just load the driver and check if loading was successful.
6992 Will not switch to graphics mode.
6993 <tag/Notes/<itemize>
6994 <item>The function is only available as fastcall function, so it may only
6995 be used in presence of a prototype.
6997 <tag/Availability/cc65
6998 <tag/See also/Other tgi functions.
7004 <sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p>
7008 <tag/Function/Load the given vector font.
7009 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7010 <tag/Declaration/<tt/const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);/
7012 Load a vector font into memory and return it. In case of errors, NULL is
7013 returned and an error is set, which can be retrieved using tgi_geterror.
7014 To use the font, it has to be installed using tgi_install_vectorfont.
7015 <tag/Notes/<itemize>
7016 <item>The function is only available as fastcall function, so it may only
7017 be used in presence of a prototype.
7019 <tag/Availability/cc65
7021 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">,
7022 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
7028 <sect1>tgi_outtext<label id="tgi_outtext"><p>
7032 <tag/Function/Output text at the current graphics cursor position.
7033 The graphics cursor is moved to the end of the text.
7034 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7035 <tag/Declaration/<tt/void __fastcall__ tgi_outtext (const char* s);/
7036 <tag/Description/Output text at the current graphics cursor position.
7037 The graphics cursor is moved to the end of the text.
7038 <tag/Notes/<itemize>
7039 <item>The function is only available as fastcall function, so it may only
7040 be used in presence of a prototype.
7042 <tag/Availability/cc65
7043 <tag/See also/Other tgi functions.
7049 <sect1>tgi_outtextxy<label id="tgi_outtextxy"><p>
7053 <tag/Function/Output text at the given cursor position.
7054 The graphics cursor is moved to the end of the text.
7055 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7056 <tag/Declaration/<tt/void __fastcall__ tgi_outtextxy (int x, int y, const char* s);/
7057 <tag/Description/Output text at the given cursor position.
7058 The graphics cursor is moved to the end of the text.
7059 <tag/Notes/<itemize>
7060 <item>The function is only available as fastcall function, so it may only
7061 be used in presence of a prototype.
7063 <tag/Availability/cc65
7064 <tag/See also/Other tgi functions.
7070 <sect1>tgi_pieslice<label id="tgi_pieslice"><p>
7074 <tag/Function/Draw an elliptic pie slice in the current color.
7075 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7076 <tag/Declaration/<tt/void __fastcall__ tgi_pie slice (int x, int y,
7077 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
7078 <tag/Description/The function draws an elliptic pie slice with center at x/y
7079 and radii rx/ry using the current drawing color. The pie slice covers the angle
7080 between sa and ea (startangle and endangle), which must be in the range
7082 <tag/Notes/<itemize>
7083 <item>The function is only available as fastcall function, so it may only
7084 be used in presence of a prototype.
7085 <item>The function behaves unexpectedly or may crash if the angles are out
7088 <tag/Availability/cc65
7090 <ref id="tgi_bar" name="tgi_arc">,
7091 <ref id="tgi_bar" name="tgi_bar">,
7092 <ref id="tgi_circle" name="tgi_circle">,
7093 <ref id="tgi_ellipse" name="tgi_ellipse">,
7094 <ref id="tgi_setcolor" name="tgi_setcolor">
7096 /* Draw the closed upper half of an ellipse */
7097 tgi_setcolor(TGI_COLOR_BLUE);
7098 tgi_pieslice (50, 50, 40, 20, 0, 180);
7104 <sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p>
7106 <quote> <descrip> <tag/Function/Set the pixel aspect ratio.
7107 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7108 <tag/Declaration/<tt/void __fastcall__ tgi_setaspectratio (unsigned ratio);/
7109 <tag/Description/The function sets the pixel aspect ratio for the current
7110 driver and display. The argument is an 8.8 fixed point value. The aspect ratio
7111 may be used to correct geometric shapes so they look correct on a given
7112 display. As an example, a circle with a radius of 100 pixels may look elliptic
7113 on some driver/display combinations if the aspect ratio is not 1.00.
7114 <tag/Notes/<itemize>
7115 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
7116 monitor for the given platform. The aspect ratio may be wrong if another
7118 <item>No TGI function will use the aspect ratio. It is up to the programmer to
7120 <item>The <tt/tgi_setaspectratio/ function can be used to change the aspect
7121 ratio for a loaded driver. The value is not reset by <ref id="tgi_init"
7122 name="tgi_init">, so if a driver is linked statically to an application,
7123 switching into and out of graphics mode will not restore the original aspect
7125 <item>The function is available only as a fastcall function; so, it may be used
7126 only in the presence of a prototype.
7128 <tag/Availability/cc65
7130 <ref id="tgi_getaspectratio" name="tgi_getaspectratio">
7136 <sect1>tgi_setcolor<label id="tgi_setcolor"><p>
7140 <tag/Function/Set color to be used in future draw operations.
7141 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7142 <tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/
7143 <tag/Description/Set color to be used in future draw operations.
7144 <tag/Notes/<itemize>
7145 <item>The function is only available as fastcall function, so it may only
7146 be used in presence of a prototype.
7148 <tag/Availability/cc65
7149 <tag/See also/Other tgi functions.
7151 tgi_setcolor(TGI_COLOR_BLACK);
7153 tgi_setcolor(TGI_COLOR_WHITE);
7154 tgi_bar(10,10,20,20);
7159 <sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p>
7163 <tag/Function/Set the page for drawing.
7164 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7165 <tag/Declaration/<tt/void __fastcall__ tgi_setdrawpage (unsigned char page);/
7166 <tag/Description/If the drawpage and the viewpage are the same then all drawing
7167 is seen immediately as it is drawn. For double buffered games you can set the
7168 drawpage to a different page than the viewpage. This lets you draw the next
7169 screen in the background and when the screen is ready you display it.
7170 <tag/Notes/<itemize>
7171 <item>The function is only available as fastcall function, so it may only
7172 be used in presence of a prototype.
7174 <tag/Availability/cc65
7175 <tag/See also/Other tgi functions.
7178 tgi_outtextxy(10, 10, "Hello World");
7179 tgi_setviewpage(1); // Show page 1
7181 tgi_outtextxy(10, 10, "Creating next frame");
7183 tgi_setviewpage(0); // Show page 0
7188 <sect1>tgi_setpalette<label id="tgi_setpalette"><p>
7192 <tag/Function/Set the palette (not available with all drivers/hardware).
7193 Palette is a pointer to as many entries as there are colors.
7194 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7195 <tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/
7196 <tag/Description/Set the palette (not available with all drivers/hardware).
7197 Palette is a pointer to as many entries as there are colors.
7198 <tag/Notes/<itemize>
7199 <item>The function is only available as fastcall function, so it may only
7200 be used in presence of a prototype.
7202 <tag/Availability/cc65
7203 <tag/See also/Other tgi functions.
7208 <sect1>tgi_setpixel<label id="tgi_setpixel"><p>
7212 <tag/Function/Plot a pixel on the drawpage with the current color.
7213 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7214 <tag/Declaration/<tt/void __fastcall__ tgi_setpixel (int x, int y);/
7215 <tag/Description/Plot a pixel on the drawpage with the current color.
7216 <tag/Notes/<itemize>
7217 <item>The function is only available as fastcall function, so it may only
7218 be used in presence of a prototype.
7220 <tag/Availability/cc65
7221 <tag/See also/Other tgi functions.
7226 <sect1>tgi_setviewpage<label id="tgi_setviewpage"><p>
7230 <tag/Function/Set page to be visible on screen.
7231 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7232 <tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/
7233 <tag/Description/If the drawpage and the viewpage are the same then all drawing
7234 is seen immediately as it is drawn. For double buffered games you can set the
7235 drawpage to a different page than the viewpage. This lets you draw the next
7236 screen in the background and when the screen is ready you display it.
7237 <tag/Notes/<itemize>
7238 <item>The function is only available as fastcall function, so it may only
7239 be used in presence of a prototype.
7241 <tag/Availability/cc65
7242 <tag/See also/Other tgi functions.
7245 tgi_outtextxy(10, 10, "Hello World");
7246 tgi_setviewpage(1); // Show page 1
7248 tgi_outtextxy(10, 10, "Creating next frame");
7250 tgi_setviewpage(0); // Show page 0
7255 <sect1>tgi_gettextheight<label id="tgi_gettextheight"><p>
7259 <tag/Function/Calculate the height of the text in pixels according to
7260 the current text style.
7261 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7262 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/
7263 <tag/Description/Calculate the height of the text in pixels according to
7264 the current text style.
7265 <tag/Notes/<itemize>
7266 <item>The function is only available as fastcall function, so it may only
7267 be used in presence of a prototype.
7269 <tag/Availability/cc65
7270 <tag/See also/Other tgi functions.
7275 <sect1>tgi_settextscale<label id="tgi_settextscale"><p>
7279 <tag/Function/Set the scaling for text output.
7280 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7281 <tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/
7283 Set the scaling for text output. The scaling factors for width and height
7284 are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
7285 <tag/Notes/<itemize>
7286 <item>The function is only available as fastcall function, so it may only
7287 be used in presence of a prototype.
7289 <tag/Availability/cc65
7291 <ref id="tgi_settextstyle" name="tgi_settextstyle">
7296 <sect1>tgi_settextstyle<label id="tgi_settextstyle"><p>
7300 <tag/Function/Set the style for text output.
7301 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7302 <tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/
7303 <tag/Description/Set the style for text output.
7304 <tag/Notes/<itemize>
7305 <item>The function is only available as fastcall function, so it may only
7306 be used in presence of a prototype.
7308 <tag/Availability/cc65
7310 <ref id="tgi_settextscale" name="tgi_settextscale">
7315 <sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p>
7319 <tag/Function/Calculate the width of the text in pixels according to the current text style.
7320 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7321 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/
7322 <tag/Description/Calculate the width of the text in pixels according to the current text style.
7323 <tag/Notes/<itemize>
7324 <item>The function is only available as fastcall function, so it may only
7325 be used in presence of a prototype.
7327 <tag/Availability/cc65
7328 <tag/See also/Other tgi functions.
7333 <sect1>tgi_uninstall<label id="tgi_uninstall"><p>
7337 <tag/Function/Uninstall the currently loaded driver but do not unload it.
7338 Will call tgi_done if necessary.
7339 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7340 <tag/Declaration/<tt/void tgi_uninstall (void);/
7341 <tag/Description/Uninstall the currently loaded driver but do not unload it.
7342 Will call tgi_done if necessary.
7343 <tag/Availability/cc65
7344 <tag/See also/Other tgi functions.
7349 <sect1>tgi_unload<label id="tgi_unload"><p>
7353 <tag/Function/Uninstall, then unload the currently loaded driver.
7354 Will call tgi_done if necessary.
7355 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7356 <tag/Declaration/<tt/void tgi_unload (void);/
7357 <tag/Description/Uninstall, then unload the currently loaded driver.
7358 Will call tgi_done if necessary.
7359 <tag/Availability/cc65
7360 <tag/See also/Other tgi functions.
7365 <sect1>time<label id="time"><p>
7369 <tag/Function/Get the time.
7370 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7371 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7372 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7373 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7374 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7375 returned and <tt/errno/ is set to <tt/ENOSYS/.
7376 <tag/Notes/<itemize>
7377 <item>The function is only available as fastcall function, so it may
7378 only be used in presence of a prototype.
7379 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7380 returned value may not be valid.
7382 <tag/Availability/ISO 9899
7384 <ref id="clock" name="clock">
7390 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7394 <tag/Function/Toggle between 40 and 80 column mode.
7395 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7396 <tag/Declaration/<tt/void toggle_videomode (void);/
7397 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7398 old mode (cursor position, color and so on) are saved and restored together
7400 <tag/Notes/<itemize>
7401 <item>The function is specific to the C128.
7402 <item>This function is deprecated. Please use <ref id="videomode"
7403 name="videomode"> instead!
7405 <tag/Availability/C128
7407 <ref id="fast" name="fast">,
7408 <ref id="slow" name="slow">,
7409 <ref id="videomode" name="videomode">
7415 <sect1>tolower<label id="tolower"><p>
7419 <tag/Function/Convert a character into its lower case representation.
7420 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7421 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7422 <tag/Description/The function returns the given character converted to lower
7423 case. If the given character is not a letter, it is returned unchanged.
7424 <tag/Notes/<itemize>
7425 <item>The function is only available as fastcall function, so it may
7426 only be used in presence of a prototype.
7428 <tag/Availability/ISO 9899
7430 <ref id="islower" name="islower">,
7431 <ref id="isupper" name="isupper">,
7432 <ref id="toupper" name="toupper">
7438 <sect1>toupper<label id="toupper"><p>
7442 <tag/Function/Convert a character into its upper case representation.
7443 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7444 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7445 <tag/Description/The function returns the given character converted to upper
7446 case. If the given character is not a letter, it is returned unchanged.
7447 <tag/Notes/<itemize>
7448 <item>The function is only available as fastcall function, so it may
7449 only be used in presence of a prototype.
7451 <tag/Availability/ISO 9899
7453 <ref id="islower" name="islower">,
7454 <ref id="isupper" name="isupper">,
7455 <ref id="tolower" name="tolower">
7461 <sect1>ultoa<label id="ultoa"><p>
7465 <tag/Function/Convert an unsigned long integer into a string.
7466 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7467 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7468 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7469 string using <tt/radix/ as the base.
7470 <tag/Notes/<itemize>
7471 <item>There are no provisions to prevent a buffer overflow.
7472 <item>The function is non standard, so it is not available in strict ANSI mode.
7473 You should probably use <tt/sprintf/ instead.
7474 <item>The function is only available as fastcall function, so it may only be
7475 used in presence of a prototype.
7477 <tag/Availability/cc65
7479 <ref id="atoi" name="atoi">,
7480 <ref id="atol" name="atol">,
7481 <ref id="itoa" name="itoa">,
7482 <ref id="ltoa" name="ltoa">,
7483 <ref id="utoa" name="utoa">
7489 <sect1>unlink<label id="unlink"><p>
7493 <tag/Function/Delete a file.
7494 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7495 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7496 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7497 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7498 code describing the reason for the failure.
7499 <tag/Notes/<itemize>
7500 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7501 name="remove">/ instead, which is a native ANSI C function and does the same.
7502 <item>This function is not available on all cc65 targets (depends on the
7503 availability of file I/O).
7504 <item>The function is only available as fastcall function, so it may only
7505 be used in presence of a prototype.
7506 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7507 used, which has the same semantics, but is more portable, because it conforms
7508 to the ISO C standard.
7510 <tag/Availability/POSIX 1003.1
7512 <ref id="remove" name="remove">
7515 #include <stdio.h>
7516 #include <unistd.h>
7518 #define FILENAME "helloworld"
7520 if (unlink (FILENAME) == 0) {
7521 printf ("We deleted %s successfully\n", FILENAME);
7523 printf ("There was a problem deleting %s\n", FILENAME);
7530 <sect1>utoa<label id="utoa"><p>
7534 <tag/Function/Convert an unsigned integer into a string.
7535 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7536 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7537 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7538 using <tt/radix/ as the base.
7539 <tag/Notes/<itemize>
7540 <item>There are no provisions to prevent a buffer overflow.
7541 <item>The function is non standard, so it is not available in strict ANSI mode.
7542 You should probably use <tt/sprintf/ instead.
7543 <item>The function is only available as fastcall function, so it may only be
7544 used in presence of a prototype.
7546 <tag/Availability/cc65
7548 <ref id="atoi" name="atoi">,
7549 <ref id="atol" name="atol">,
7550 <ref id="itoa" name="itoa">,
7551 <ref id="ltoa" name="ltoa">,
7552 <ref id="ultoa" name="ultoa">
7558 <sect1>vcprintf<label id="vcprintf"><p>
7562 <tag/Function/Formatted output to the console.
7563 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7564 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7565 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7566 text where necessary and formatted according to the format string given. The
7567 resulting string is output to the console. <tt/vcprintf/ supports the same
7568 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7569 <tag/Notes/<itemize>
7570 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7571 between <tt/\r/ and <tt/\n/.
7572 <item>The function is only available as fastcall function, so it may only be
7573 used in presence of a prototype.
7575 <tag/Availability/cc65
7577 <ref id="cprintf" name="cprintf">,
7578 <ref id="cputc" name="cputc">,
7579 <ref id="cputcxy" name="cputcxy">,
7580 <ref id="cputs" name="cputs">,
7581 <ref id="cputsxy" name="cputsxy">
7587 <sect1>videomode<label id="videomode"><p>
7591 <tag/Function/Switch to either 40 or 80 column mode.
7592 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7593 <ref id="c128.h" name="c128.h">/
7594 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7595 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7596 the requested mode is already active, nothing happens. The old mode is returned
7598 <tag/Notes/<itemize>
7599 <item>The function is specific to the C128 and enhanced Apple //e.
7600 <item>This function replaces <ref id="toggle_videomode"
7601 name="toggle_videomode">.
7602 <item>The function is only available as fastcall function, so it may only be
7603 used in presence of a prototype.
7605 <tag/Availability/C128 and enhanced Apple //e
7607 <ref id="fast" name="fast">,
7608 <ref id="slow" name="slow">,
7609 <ref id="toggle_videomode" name="toggle_videomode">
7615 <sect1>waitvsync<label id="waitvsync"><p>
7619 <tag/Function/Wait until the start of the next frame.
7621 <tt/<ref id="gamate.h" name="gamate.h">/,
7622 <tt/<ref id="nes.h" name="nes.h">/,
7623 <tt/<ref id="pce.h" name="pce.h">/
7624 <tag/Declaration/<tt/void waitvsync (void);/
7625 <tag/Description/Wait for vertical sync to reduce flickering.
7626 <tag/Availability/Platforms above
7632 <sect1>wherex<label id="wherex"><p>
7636 <tag/Function/Return the current X position of the text mode cursor.
7637 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7638 <tag/Declaration/<tt/unsigned char wherex (void);/
7639 <tag/Description/The function returns the current X position of the text mode
7640 cursor. Zero is returned for the leftmost screen position.
7641 <tag/Availability/cc65
7643 <ref id="gotox" name="gotox">,
7644 <ref id="gotoy" name="gotoy">,
7645 <ref id="gotoxy" name="gotoxy">,
7646 <ref id="wherey" name="wherey">
7652 <sect1>wherey<label id="wherey"><p>
7656 <tag/Function/Return the current Y position of the text mode cursor.
7657 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7658 <tag/Declaration/<tt/unsigned char wherey (void);/
7659 <tag/Description/The function returns the current Y position of the text mode
7660 cursor. Zero is returned for the uppermost screen position.
7661 <tag/Availability/cc65
7663 <ref id="gotox" name="gotox">,
7664 <ref id="gotoy" name="gotoy">,
7665 <ref id="gotoxy" name="gotoxy">,
7666 <ref id="wherex" name="wherex">