1 <!doctype linuxdoc system> <!-- -*- text-mode -*- -->
4 <title>cc65 function reference
5 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
9 cc65 is a C compiler for 6502 based systems. This function reference describes
10 the C functions available in the standard library.
13 <!-- Table of contents -->
16 <!-- Begin the document -->
20 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
21 C standard plus additional functions specially crafted for 6502 systems or
22 just some of the supported machines. This function refrence describes the
23 available functions together with any limitations.
25 For an overview about the available libraries, their purpose, and any
26 differences to the ISO standard, please have a look at the <url
27 url="library.html" name="cc65 Library Overview">.
29 <em/Note:/ Standard C functions are listed here, but not described in detail.
30 Since these functions behave identical on all standard compliant systems, they
31 are described in any book covering standard C.
33 Each entry for a function contains a detailed description
37 <tag/Function/Summary of what <bf/function/ does.
38 <tag/Header/The header file that contains the declaration.
39 <tag/Declaration/Describes the needed header files and declaration of the
41 <tag/Description/Description of the function.
42 <tag/Notes/Notes on the function.
43 <tag/Availability/The availability of the function.
44 <tag/See also/Other related functions.
45 <tag/Example/A piece of actual code using the function.
50 <sect>Functions by header file<p>
52 <sect1><tt/6502.h/<label id="6502.h"><p>
55 <item><ref id="BRK" name="BRK">
56 <item><ref id="CLI" name="CLI">
57 <item><ref id="SEI" name="SEI">
58 <item><ref id="_sys" name="_sys">
59 <item><ref id="getcpu" name="getcpu">
60 <item><ref id="reset_brk" name="reset_brk">
61 <item><ref id="reset_irq" name="reset_irq">
62 <item><ref id="set_brk" name="set_brk">
63 <item><ref id="set_irq" name="set_irq">
67 <sect1><tt/apple2.h/<label id="apple2.h"><p>
71 <item><ref id="get_ostype" name="get_ostype">
76 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
80 <item><ref id="get_ostype" name="get_ostype">
84 <item><ref id="videomode" name="videomode">
88 <sect1><tt/assert.h/<label id="assert.h"><p>
91 <item><ref id="assert" name="assert">
95 <sect1><tt/atari.h/<label id="atari.h"><p>
98 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
99 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
100 <!-- <item><ref id="_graphics" name="_graphics"> -->
101 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
102 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
103 <!-- <item><ref id="_scroll" name="_scroll"> -->
104 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
105 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
106 <item><ref id="get_ostype" name="get_ostype">
107 <!-- <item><ref id="get_tv" name="get_tv"> -->
113 <sect1><tt/atmos.h/<label id="atmos.h"><p>
116 <item><ref id="atmos_load" name="atmos_load">
117 <item><ref id="atmos_save" name="atmos_save">
118 <!-- <item><ref id="atmos_explode" name="atmos_explode"> -->
119 <!-- <item><ref id="atmos_ping" name="atmos_ping"> -->
120 <!-- <item><ref id="atmos_shoot" name="atmos_shoot"> -->
121 <!-- <item><ref id="atmos_tick" name="atmos_tick"> -->
122 <!-- <item><ref id="atmos_tock" name="atmos_tock"> -->
123 <!-- <item><ref id="atmos_zap" name="atmos_zap"> -->
129 <sect1><tt/c128.h/<label id="c128.h"><p>
132 <item><ref id="c64mode" name="c64mode">
133 <item><ref id="fast" name="fast">
134 <item><ref id="slow" name="slow">
135 <item><ref id="toggle_videomode" name="toggle_videomode">
136 <item><ref id="videomode" name="videomode">
140 <sect1><tt/c16.h/<label id="c16.h"><p>
145 <sect1><tt/c64.h/<label id="c64.h"><p>
148 <item><ref id="get_ostype" name="get_ostype">
152 <sect1><tt/cbm.h/<label id="cbm.h"><p>
155 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
156 <item><ref id="cbm_k_basin" name="cbm_k_basin">
157 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
158 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
159 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
160 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
161 <item><ref id="cbm_k_clall" name="cbm_k_clall">
162 <item><ref id="cbm_k_close" name="cbm_k_close">
163 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
164 <item><ref id="cbm_k_getin" name="cbm_k_getin">
165 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
166 <item><ref id="cbm_k_listen" name="cbm_k_listen">
167 <item><ref id="cbm_k_load" name="cbm_k_load">
168 <item><ref id="cbm_k_open" name="cbm_k_open">
169 <item><ref id="cbm_k_readst" name="cbm_k_readst">
170 <item><ref id="cbm_k_save" name="cbm_k_save">
171 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
172 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
173 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
174 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
175 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
176 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
177 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
178 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
179 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
180 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
181 <!-- <item><ref id="get_tv" name="get_tv"> -->
187 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
190 <item><ref id="peekbsys" name="peekbsys">
191 <item><ref id="peekwsys" name="peekwsys">
192 <item><ref id="pokebsys" name="pokebsys">
193 <item><ref id="pokewsys" name="pokewsys">
197 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
200 <item><ref id="peekbsys" name="peekbsys">
201 <item><ref id="peekwsys" name="peekwsys">
202 <item><ref id="pokebsys" name="pokebsys">
203 <item><ref id="pokewsys" name="pokewsys">
207 <sect1><tt/cc65.h/<label id="cc65.h"><p>
210 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
211 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
212 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
213 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
214 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
215 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
216 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
217 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
218 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
224 <sect1><tt/conio.h/<label id="conio.h"><p>
227 <item><ref id="bgcolor" name="bgcolor">
228 <item><ref id="bordercolor" name="bordercolor">
229 <item><ref id="cclear" name="cclear">
230 <item><ref id="cclearxy" name="cclearxy">
231 <item><ref id="cgetc" name="cgetc">
232 <item><ref id="chline" name="chline">
233 <item><ref id="chlinexy" name="chlinexy">
234 <item><ref id="clrscr" name="clrscr">
235 <item><ref id="cprintf" name="cprintf">
236 <item><ref id="cputc" name="cputc">
237 <item><ref id="cputcxy" name="cputcxy">
238 <item><ref id="cputs" name="cputs">
239 <item><ref id="cputsxy" name="cputsxy">
240 <item><ref id="cursor" name="cursor">
241 <item><ref id="cvline" name="cvline">
242 <item><ref id="cvlinexy" name="cvlinexy">
243 <item><ref id="gotox" name="gotox">
244 <item><ref id="gotoxy" name="gotoxy">
245 <item><ref id="gotoy" name="gotoy">
246 <item><ref id="kbhit" name="kbhit">
247 <item><ref id="revers" name="revers">
248 <item><ref id="screensize" name="screensize">
249 <item><ref id="textcolor" name="textcolor">
250 <item><ref id="vcprintf" name="vcprintf">
251 <item><ref id="wherex" name="wherex">
252 <item><ref id="wherey" name="wherey">
256 <sect1><tt/ctype.h/<label id="ctype.h"><p>
259 <item><ref id="isalnum" name="isalnum">
260 <item><ref id="isalpha" name="isalpha">
261 <item><ref id="isascii" name="isascii">
262 <item><ref id="isblank" name="isblank">
263 <item><ref id="iscntrl" name="iscntrl">
264 <item><ref id="isdigit" name="isdigit">
265 <item><ref id="isgraph" name="isgraph">
266 <item><ref id="islower" name="islower">
267 <item><ref id="isprint" name="isprint">
268 <item><ref id="ispunct" name="ispunct">
269 <item><ref id="isspace" name="isspace">
270 <item><ref id="isupper" name="isupper">
271 <item><ref id="isxdigit" name="isxdigit">
272 <item><ref id="tolower" name="tolower">
273 <item><ref id="toupper" name="toupper">
277 <sect1><tt/dbg.h/<label id="dbg.h"><p>
280 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
286 <sect1><tt/dio.h/<label id="dio.h"><p>
288 <url url="dio.html" name="Low-level disk I/O API">.
291 <sect1><tt/dirent.h/<label id="dirent.h"><p>
294 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
295 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
296 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
297 <item><ref id="_DE_ISREG" name="_DE_ISREG">
298 <item><ref id="closedir" name="closedir">
299 <item><ref id="opendir" name="opendir">
300 <item><ref id="readdir" name="readdir">
301 <item><ref id="rewinddir" name="rewinddir">
302 <item><ref id="seekdir" name="seekdir">
303 <item><ref id="telldir" name="telldir">
309 <sect1><tt/em.h/<label id="em.h"><p>
312 <item><ref id="em_commit" name="em_commit">
313 <item><ref id="em_copyfrom" name="em_copyfrom">
314 <item><ref id="em_copyto" name="em_copyto">
315 <item><ref id="em_install" name="em_install">
316 <item><ref id="em_load_driver" name="em_load_driver">
317 <item><ref id="em_map" name="em_map">
318 <item><ref id="em_pagecount" name="em_pagecount">
319 <item><ref id="em_uninstall" name="em_uninstall">
320 <item><ref id="em_unload" name="em_unload">
321 <item><ref id="em_use" name="em_use">
325 <sect1><tt/errno.h/<label id="errno.h"><p>
328 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
329 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
330 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
331 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
337 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
340 <item><ref id="close" name="close">
341 <item><ref id="creat" name="creat">
342 <item><ref id="open" name="open">
346 <sect1><tt/geos.h/<label id="geos.h"><p>
351 <sect1><tt/joystick.h/<label id="joystick.h"><p>
354 <item><ref id="joy_count" name="joy_count">
355 <item><ref id="joy_install" name="joy_install">
356 <item><ref id="joy_load_driver" name="joy_load_driver">
357 <item><ref id="joy_read" name="joy_read">
358 <item><ref id="joy_uninstall" name="joy_uninstall">
359 <item><ref id="joy_unload" name="joy_unload">
363 <sect1><tt/locale.h/<label id="locale.h"><p>
366 <item><ref id="localeconv" name="localeconv">
367 <item><ref id="setlocale" name="setlocale">
371 <sect1><tt/lynx.h/<label id="lynx.h"><p>
374 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
375 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
376 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
377 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
378 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
379 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
380 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
386 <sect1><tt/modload.h/<label id="modload.h"><p>
389 <item><ref id="mod_load" name="mod_load">
390 <item><ref id="mod_free" name="mod_free">
394 <sect1><tt/mouse.h/<label id="mouse.h"><p>
397 <item><ref id="mouse_buttons" name="mouse_buttons">
398 <item><ref id="mouse_getbox" name="mouse_getbox">
399 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
400 <item><ref id="mouse_hide" name="mouse_hide">
401 <item><ref id="mouse_info" name="mouse_info">
402 <item><ref id="mouse_install" name="mouse_install">
403 <item><ref id="mouse_ioctl" name="mouse_ioctl">
404 <item><ref id="mouse_load_driver" name="mouse_load_driver">
405 <item><ref id="mouse_move" name="mouse_move">
406 <item><ref id="mouse_pos" name="mouse_pos">
407 <item><ref id="mouse_setbox" name="mouse_setbox">
408 <item><ref id="mouse_show" name="mouse_show">
409 <item><ref id="mouse_uninstall" name="mouse_uninstall">
410 <item><ref id="mouse_unload" name="mouse_unload">
414 <sect1><tt/nes.h/<label id="nes.h"><p>
417 <!-- <item><ref id="get_tv" name="get_tv"> -->
418 <!-- <item><ref id="waitvblank" name="waitvblank"> -->
424 <sect1><tt/o65.h/<label id="o65.h"><p>
426 The <tt/o65.h/ header file contains structure and constant definitions that
427 may be used when dealing with files in <url
428 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
429 It does not declare any functions.
432 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
435 <item><ref id="PEEK" name="PEEK">
436 <item><ref id="PEEKW" name="PEEKW">
437 <item><ref id="POKE" name="POKE">
438 <item><ref id="POKEW" name="POKEW">
442 <sect1><tt/pet.h/<label id="pet.h"><p>
447 <sect1><tt/plus4.h/<label id="plus4.h"><p>
452 <sect1><tt/serial.h/<label id="serial.h"><p>
454 The <tt/serial.h/ header file contains definitions for initializing serial
458 <item><ref id="ser_close" name="ser_close">
459 <item><ref id="ser_get" name="ser_get">
460 <item><ref id="ser_install" name="ser_install">
461 <item><ref id="ser_ioctl" name="ser_ioctl">
462 <item><ref id="ser_load_driver" name="ser_load_driver">
463 <item><ref id="ser_open" name="ser_open">
464 <item><ref id="ser_put" name="ser_put">
465 <item><ref id="ser_status" name="ser_status">
466 <item><ref id="ser_uninstall" name="ser_uninstall">
467 <item><ref id="ser_unload" name="ser_unload">
471 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
474 <item><ref id="setjmp" name="setjmp">
475 <item><ref id="longjmp" name="longjmp">
479 <sect1><tt/signal.h/<label id="signal.h"><p>
482 <item><ref id="raise" name="raise">
483 <item><ref id="signal" name="signal">
487 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
492 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
497 <sect1><tt/stddef.h/<label id="stddef.h"><p>
500 <item><ref id="offsetof" name="offsetof">
504 <sect1><tt/stdio.h/<label id="stdio.h"><p>
507 <item><ref id="_poserror" name="_poserror">
508 <item><ref id="clearerr" name="clearerr">
509 <!-- <item><ref id="fclose" name="fclose"> -->
510 <!-- <item><ref id="fdopen" name="fdopen"> -->
511 <item><ref id="feof" name="feof">
512 <item><ref id="ferror" name="ferror">
513 <!-- <item><ref id="fflush" name="fflush"> -->
514 <!-- <item><ref id="fgetc" name="fgetc"> -->
515 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
516 <!-- <item><ref id="fgets" name="fgets"> -->
517 <item><ref id="fileno" name="fileno">
518 <!-- <item><ref id="fopen" name="fopen"> -->
519 <!-- <item><ref id="fprintf" name="fprintf"> -->
520 <!-- <item><ref id="fputc" name="fputc"> -->
521 <!-- <item><ref id="fputs" name="fputs"> -->
522 <!-- <item><ref id="fread" name="fread"> -->
523 <!-- <item><ref id="freopen" name="freopen"> -->
524 <!-- <item><ref id="fscanf" name="fscanf"> -->
525 <!-- <item><ref id="fseek" name="fseek"> -->
526 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
527 <!-- <item><ref id="ftell" name="ftell"> -->
528 <!-- <item><ref id="fwrite" name="fwrite"> -->
529 <!-- <item><ref id="getc" name="getc"> -->
530 <!-- <item><ref id="getchar" name="getchar"> -->
531 <!-- <item><ref id="gets" name="gets"> -->
532 <!-- <item><ref id="printf" name="printf"> -->
533 <!-- <item><ref id="putc" name="putc"> -->
534 <!-- <item><ref id="putchar" name="putchar"> -->
535 <!-- <item><ref id="puts" name="puts"> -->
536 <item><ref id="rename" name="rename">
537 <item><ref id="remove" name="remove">
538 <!-- <item><ref id="rewind" name="rewind"> -->
539 <!-- <item><ref id="scanf" name="scanf"> -->
540 <!-- <item><ref id="snprintf" name="snprintf"> -->
541 <!-- <item><ref id="sprintf" name="sprintf"> -->
542 <!-- <item><ref id="sscanf" name="sscanf"> -->
543 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
544 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
545 <!-- <item><ref id="vprintf" name="vprintf"> -->
546 <!-- <item><ref id="vscanf" name="vscanf"> -->
547 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
548 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
549 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
555 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
558 <item><ref id="_heapadd" name="_heapadd">
559 <item><ref id="_heapblocksize" name="_heapblocksize">
560 <item><ref id="_heapmaxavail" name="_heapmaxavail">
561 <item><ref id="_heapmemavail" name="_heapmemavail">
562 <item><ref id="_randomize" name="_randomize">
563 <item><ref id="_swap" name="_swap">
564 <item><ref id="abort" name="abort">
565 <item><ref id="abs" name="abs">
566 <item><ref id="atexit" name="atexit">
567 <item><ref id="atoi" name="atoi">
568 <item><ref id="atol" name="atol">
569 <item><ref id="bsearch" name="bsearch">
570 <item><ref id="calloc" name="calloc">
571 <item><ref id="div" name="div">
572 <item><ref id="exit" name="exit">
573 <item><ref id="free" name="free">
574 <item><ref id="getenv" name="getenv">
575 <item><ref id="itoa" name="itoa">
576 <item><ref id="labs" name="labs">
577 <item><ref id="ltoa" name="ltoa">
578 <item><ref id="malloc" name="malloc">
579 <item><ref id="perror" name="perror">
580 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
581 <!-- <item><ref id="putenv" name="putenv"> -->
582 <item><ref id="qsort" name="qsort">
583 <item><ref id="rand" name="rand">
584 <item><ref id="realloc" name="realloc">
585 <item><ref id="srand" name="srand">
586 <!-- <item><ref id="system" name="system"> -->
587 <item><ref id="ultoa" name="ultoa">
588 <item><ref id="utoa" name="utoa">
594 <sect1><tt/string.h/<label id="string.h"><p>
597 <item><ref id="_stroserror" name="_stroserror">
598 <item><ref id="bzero" name="bzero">
599 <item><ref id="memchr" name="memchr">
600 <item><ref id="memcmp" name="memcmp">
601 <item><ref id="memcpy" name="memcpy">
602 <item><ref id="memmove" name="memmove">
603 <item><ref id="memset" name="memset">
604 <item><ref id="strcasecmp" name="strcasecmp">
605 <item><ref id="strcat" name="strcat">
606 <item><ref id="strchr" name="strchr">
607 <item><ref id="strcmp" name="strcmp">
608 <item><ref id="strcoll" name="strcoll">
609 <item><ref id="strcpy" name="strcpy">
610 <item><ref id="strcspn" name="strcspn">
611 <item><ref id="strdup" name="strdup">
612 <item><ref id="strerror" name="strerror">
613 <item><ref id="stricmp" name="stricmp">
614 <item><ref id="strlen" name="strlen">
615 <item><ref id="strlower" name="strlower">
616 <item><ref id="strlwr" name="strlwr">
617 <item><ref id="strncat" name="strncat">
618 <item><ref id="strncmp" name="strncmp">
619 <item><ref id="strncpy" name="strncpy">
620 <item><ref id="strqtok" name="strqtok">
621 <item><ref id="strrchr" name="strrchr">
622 <item><ref id="strspn" name="strspn">
623 <item><ref id="strstr" name="strstr">
624 <item><ref id="strtok" name="strtok">
625 <item><ref id="strxfrm" name="strxfrm">
626 <item><ref id="strupper" name="strupper">
627 <item><ref id="strupr" name="strupr">
633 <sect1><tt/tgi.h/<label id="tgi.h"><p>
636 <item><ref id="tgi_arc" name="tgi_arc">
637 <item><ref id="tgi_bar" name="tgi_bar">
638 <item><ref id="tgi_circle" name="tgi_circle">
639 <item><ref id="tgi_clear" name="tgi_clear">
640 <item><ref id="tgi_done" name="tgi_done">
641 <item><ref id="tgi_ellipse" name="tgi_ellipse">
642 <item><ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
643 <item><ref id="tgi_getaspectratio" name="tgi_getaspectratio">
644 <item><ref id="tgi_getcolor" name="tgi_getcolor">
645 <item><ref id="tgi_getcolorcount" name="tgi_getcolorcount">
646 <item><ref id="tgi_getdefpalette" name="tgi_getdefpalette">
647 <item><ref id="tgi_geterror" name="tgi_geterror">
648 <item><ref id="tgi_geterrormsg" name="tgi_geterrormsg">
649 <item><ref id="tgi_getmaxcolor" name="tgi_getmaxcolor">
650 <item><ref id="tgi_getmaxx" name="tgi_getmaxx">
651 <item><ref id="tgi_getmaxy" name="tgi_getmaxy">
652 <item><ref id="tgi_getpagecount" name="tgi_getpagecount">
653 <item><ref id="tgi_getpalette" name="tgi_getpalette">
654 <item><ref id="tgi_getpixel" name="tgi_getpixel">
655 <item><ref id="tgi_gettextheight" name="tgi_gettextheight">
656 <item><ref id="tgi_gettextwidth" name="tgi_gettextwidth">
657 <item><ref id="tgi_getxres" name="tgi_getxres">
658 <item><ref id="tgi_getyres" name="tgi_getyres">
659 <item><ref id="tgi_gotoxy" name="tgi_gotoxy">
660 <item><ref id="tgi_init" name="tgi_init">
661 <item><ref id="tgi_install" name="tgi_install">
662 <item><ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
663 <item><ref id="tgi_ioctl" name="tgi_ioctl">
664 <item><ref id="tgi_line" name="tgi_line">
665 <item><ref id="tgi_lineto" name="tgi_lineto">
666 <item><ref id="tgi_load_driver" name="tgi_load_driver">
667 <item><ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">
668 <item><ref id="tgi_outtext" name="tgi_outtext">
669 <item><ref id="tgi_outtextxy" name="tgi_outtextxy">
670 <item><ref id="tgi_setaspectratio" name="tgi_setaspectratio">
671 <item><ref id="tgi_setcolor" name="tgi_setcolor">
672 <item><ref id="tgi_setdrawpage" name="tgi_setdrawpage">
673 <item><ref id="tgi_setpalette" name="tgi_setpalette">
674 <item><ref id="tgi_setpixel" name="tgi_setpixel">
675 <item><ref id="tgi_setviewpage" name="tgi_setviewpage">
676 <item><ref id="tgi_settextscale" name="tgi_settextscale">
677 <item><ref id="tgi_settextstyle" name="tgi_settextstyle">
678 <item><ref id="tgi_uninstall" name="tgi_uninstall">
679 <item><ref id="tgi_unload" name="tgi_unload">
682 <sect1><tt/time.h/<label id="time.h"><p>
685 <!-- <item><ref id="_systime" name="_systime"> -->
686 <!-- <item><ref id="asctime" name="asctime"> -->
687 <item><ref id="clock" name="clock">
688 <!-- <item><ref id="ctime" name="ctime"> -->
689 <!-- <item><ref id="gmtime" name="gmtime"> -->
690 <!-- <item><ref id="localtime" name="localtime"> -->
691 <!-- <item><ref id="mktime" name="mktime"> -->
692 <!-- <item><ref id="strftime" name="strftime"> -->
693 <item><ref id="time" name="time">
699 <sect1><tt/unistd.h/<label id="unistd.h"><p>
702 <!-- <item><ref id="chdir" name="chdir"> -->
703 <item><ref id="exec" name="exec">
704 <!-- <item><ref id="getcwd" name="getcwd"> -->
705 <item><ref id="getopt" name="getopt">
706 <!-- <item><ref id="lseek" name="lseek"> -->
707 <!-- <item><ref id="mkdir" name="mkdir"> -->
708 <!-- <item><ref id="read" name="read"> -->
709 <!-- <item><ref id="rmdir" name="rmdir"> -->
710 <item><ref id="sleep" name="sleep">
711 <item><ref id="unlink" name="unlink">
712 <!-- <item><ref id="write" name="write"> -->
718 <sect1><tt/vic20.h/<label id="vic20.h"><p>
723 <sect1><tt/zlib.h/<label id="zlib.h"><p>
726 <!-- <item><ref id="adler32" name="adler32"> -->
727 <!-- <item><ref id="crc32" name="crc32"> -->
728 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
729 <!-- <item><ref id="uncompress" name="uncompress"> -->
735 <sect>Alphabetical function reference<p>
737 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
741 <tag/Function/Determine if a directory entry specifies a directory.
742 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
743 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
744 <tag/Description/The function is called with the type of a directory entry
745 taken from a <tt/struct dirent/ and returns true if the entry designates
748 <item>The function is actually a macro.
750 <tag/Availability/cc65
752 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
753 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
754 <ref id="_DE_ISREG" name="_DE_ISREG">
760 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
764 <tag/Function/Determine if a directory entry specifies a disk label.
765 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
766 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
767 <tag/Description/The function is called with the type of a directory entry
768 taken from a <tt/struct dirent/ and returns true if the entry designates
771 <item>The function is actually a macro.
773 <tag/Availability/cc65
775 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
776 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
777 <ref id="_DE_ISREG" name="_DE_ISREG">
783 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
787 <tag/Function/Determine if a directory entry specifies a link.
788 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
789 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
790 <tag/Description/The function is called with the type of a directory entry
791 taken from a <tt/struct dirent/ and returns true if the entry designates
794 <item>The function is actually a macro.
796 <tag/Availability/cc65
798 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
799 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
800 <ref id="_DE_ISREG" name="_DE_ISREG">
806 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
810 <tag/Function/Determine if a directory entry specifies a regular file.
811 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
812 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
813 <tag/Description/The function is called with the type of a directory entry
814 taken from a <tt/struct dirent/ and returns true if the entry designates
817 <item>The function is actually a macro.
818 <item>A "regular file" means anything with data in it. This might still mean
819 that special processing is needed, when accessing the file. Relative files of
820 the CBM systems are classified as being "regular" files, for example.
822 <tag/Availability/cc65
824 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
825 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
826 <ref id="_DE_ISLNK" name="_DE_ISLNK">
832 <sect1>_heapadd<label id="_heapadd"><p>
836 <tag/Function/Add a block to the heap.
837 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
838 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
839 <tag/Description/The function adds a block of raw memory to the heap.
841 <item>The minimum blocksize that can be added is 6 bytes; the function will
842 ignore smaller blocks.
844 <tag/Availability/cc65
846 <ref id="_heapblocksize" name="_heapblocksize">,
847 <ref id="_heapmaxavail" name="_heapmaxavail">,
848 <ref id="_heapmemavail" name="_heapmemavail">,
849 <ref id="calloc" name="calloc">,
850 <ref id="free" name="free">,
851 <ref id="malloc" name="malloc">,
852 <ref id="realloc" name="realloc">
858 <sect1>_heapblocksize<label id="_heapblocksize"><p>
862 <tag/Function/Return the size of an allocated block.
863 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
864 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
865 <tag/Description/The function returns the size of a block that must have
866 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
867 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
869 <item>Passing a pointer to a block that was is not the result of one of the
870 allocation functions, or that has been free'd will give unpredicable results.
872 <tag/Availability/cc65
874 <ref id="_heapadd" name="_heapadd">,
875 <ref id="_heapmaxavail" name="_heapmaxavail">,
876 <ref id="_heapmemavail" name="_heapmemavail">,
877 <ref id="calloc" name="calloc">,
878 <ref id="free" name="free">,
879 <ref id="malloc" name="malloc">,
880 <ref id="realloc" name="realloc">
886 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
890 <tag/Function/Return the largest block that is available on the heap.
891 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
892 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
893 <tag/Description/The function returns the size of the largest block that may
894 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
895 <tag/Availability/cc65
897 <ref id="_heapadd" name="_heapadd">,
898 <ref id="_heapblocksize" name="_heapblocksize">,
899 <ref id="_heapmemavail" name="_heapmemavail">,
900 <ref id="calloc" name="calloc">,
901 <ref id="free" name="free">,
902 <ref id="malloc" name="malloc">,
903 <ref id="realloc" name="realloc">
909 <sect1>_heapmemavail<label id="_heapmemavail"><p>
913 <tag/Function/Return the total available space on the heap.
914 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
915 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
916 <tag/Description/The function returns the total number of bytes available on
919 <item>This function is of less use than usually assumed, since the returned
920 heap space may be available but not in one block. So even if this function
921 says that several times more heap space is available than needed, <ref
922 id="malloc" name="malloc"> may still return <tt/NULL/.
924 <tag/Availability/cc65
926 <ref id="_heapadd" name="_heapadd">,
927 <ref id="_heapblocksize" name="_heapblocksize">,
928 <ref id="_heapmaxavail" name="_heapmaxavail">,
929 <ref id="calloc" name="calloc">,
930 <ref id="free" name="free">,
931 <ref id="malloc" name="malloc">,
932 <ref id="realloc" name="realloc">
938 <sect1>_poserror<label id="_poserror"><p>
942 <tag/Function/Print an error message for the error in <tt/_oserror/.
943 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
944 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
945 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
946 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
947 a colon and a blank. Then the error message for the current contents of
948 <tt/_oserror/ are printed followed by a newline. The message output is the
949 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
950 argument of <tt/_oserror/.
952 <item>Since operating system specific error code are - you guessed it -
953 operating system specific, the value in <tt/_oserror/ and the message that is
954 printed depends on the cc65 target.
955 <item>The function is only available as fastcall function, so it may only
956 be used in presence of a prototype.
958 <tag/Availability/cc65
960 <ref id="_stroserror" name="_stroserror">,
961 <ref id="perror" name="perror">
967 <sect1>_randomize<label id="_randomize"><p>
971 <tag/Function/Initialize the pseudo random number generator.
972 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
973 <tag/Declaration/<tt/void _randomize (void);/
974 <tag/Description/The function initializes the random number generator with
975 a seed derived from fast changing hardware events, so the seed itself can be
976 considered random to a certain degree.
978 <item>The randomness of the seed depends on the machine hardware.
980 <tag/Availability/cc65
982 <ref id="rand" name="rand">,
983 <ref id="srand" name="srand">
989 <sect1>_stroserror<label id="_stroserror"><p>
993 <tag/Function/Return a string describing an OS specific error code.
994 <tag/Header/<tt/<ref id="string.h" name="string.h">/
995 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
996 <tag/Description/<tt/_stroserror/ will return a string describing the given
997 operating system specific error code.
999 <item>Since operating system specific error code are - you guessed it -
1000 operating system specific, the parameter and the string returned depend on the
1002 <item>The function is only available as fastcall function, so it may only be
1003 used in presence of a prototype.
1005 <tag/Availability/cc65
1007 <ref id="strerror" name="strerror">
1013 <sect1>_swap<label id="_swap"><p>
1017 <tag/Function/Swap the contents of memory areas.
1018 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1019 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1020 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1021 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1022 <tt/size/ bytes in size.
1023 <tag/Notes/<itemize>
1024 <item>The memory areas may not overlap, otherwise the results are undefined.
1025 <item>The function is only available as fastcall function, so it may only be
1026 used in presence of a prototype.
1028 <tag/Availability/cc65
1030 <ref id="memcpy" name="memcpy">,
1031 <ref id="memmove" name="memmove">
1037 <sect1>_sys<label id="_sys"><p>
1041 <tag/Function/Call a subroutine passing register values.
1042 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1043 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1044 <tag/Description/The function will call the subroutine at the address
1045 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1046 registers and the CPU flags are set to the values given in the <tt/regs/
1047 structure. On return from the subroutine, the new values of the registers and
1048 flags are stored back overwriting the old values.
1049 <tag/Notes/<itemize>
1050 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1051 when calling the subroutine (they are unchanged from their current values).
1052 <item>The function is only available as fastcall function, so it may only be
1053 used in presence of a prototype.
1055 <tag/Availability/cc65
1061 <sect1>BRK<label id="BRK"><p>
1065 <tag/Function/Insert a 6502 BRK instrunction into the code.
1066 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1067 <tag/Declaration/<tt/void BRK (void);/
1068 <tag/Description/The function will insert a 6502 BRK instruction into the code
1069 which may be used to trigger a debugger.
1070 <tag/Notes/<itemize>
1071 <item>The function is actually a macro.
1072 <item>The inserted instruction may lead to unexpected results if no debugger
1075 <tag/Availability/cc65
1077 <ref id="CLI" name="CLI">,
1078 <ref id="SEI" name="SEI">
1084 <sect1>CLI<label id="CLI"><p>
1088 <tag/Function/Insert a 6502 CLI instrunction into the code.
1089 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1090 <tag/Declaration/<tt/void CLI (void);/
1091 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1092 so interrupts are enabled. Enabling interrupts has no effects if they are
1093 already enabled (the default).
1094 <tag/Notes/<itemize>
1095 <item>The function is actually a macro.
1096 <item>Disabling interrupts may lead to unexpected results.
1098 <tag/Availability/cc65
1100 <ref id="BRK" name="BRK">,
1101 <ref id="SEI" name="SEI">
1107 <sect1>PEEK<label id="PEEK"><p>
1111 <tag/Function/Read a byte from memory.
1112 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1113 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1114 <tag/Description/The function will read the absolute memory given by <tt/addr/
1115 and return the value read.
1116 <tag/Notes/<itemize>
1117 <item>The function is actually a macro.
1118 <item>This function depends highly on the platform and environment.
1120 <tag/Availability/cc65
1122 <ref id="PEEKW" name="PEEKW">,
1123 <ref id="POKE" name="POKE">
1129 <sect1>PEEKW<label id="PEEKW"><p>
1133 <tag/Function/Read a word (two bytes) from memory.
1134 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1135 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1136 <tag/Description/The function will read the absolute memory given by <tt/addr/
1137 and return the value read. The byte read from the higher address is the high
1138 byte of the return value.
1139 <tag/Notes/<itemize>
1140 <item>The function is actually a macro.
1141 <item>This function depends highly on the platform and environment.
1142 <item>The order in which the two bytes are read is unspecified and may
1143 depend of the address expression used.
1145 <tag/Availability/cc65
1147 <ref id="PEEK" name="PEEK">,
1148 <ref id="POKE" name="POKE">
1154 <sect1>POKE<label id="POKE"><p>
1158 <tag/Function/Write a byte to memory.
1159 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1160 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1161 <tag/Description/The function writes the value <tt/val/ to the absolute
1162 memory address given by <tt/addr/.
1163 <tag/Notes/<itemize>
1164 <item>The function is actually a macro.
1165 <item>This function depends highly on the platform and environment.
1166 <item>Careless use will cause the program to act strange or may crash the
1169 <tag/Availability/cc65
1171 <ref id="PEEK" name="PEEK">,
1172 <ref id="POKEW" name="POKEW">
1178 <sect1>POKEW<label id="POKEW"><p>
1182 <tag/Function/Write a word (two bytes) to memory.
1183 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1184 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1185 <tag/Description/The function writes the value <tt/val/ to the absolute
1186 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1187 the <tt/addr/, the high byte is written to <tt/addr+1/.
1188 <tag/Notes/<itemize>
1189 <item>The function is actually a macro.
1190 <item>This function depends highly on the platform and environment.
1191 <item>Careless use will cause the program to act strange or may crash the
1193 <item>The order in which the two bytes are written is unspecified and may
1194 depend of the address expression used.
1196 <tag/Availability/cc65
1198 <ref id="PEEK" name="PEEK">,
1199 <ref id="POKE" name="POKE">
1205 <sect1>SEI<label id="SEI"><p>
1209 <tag/Function/Insert a 6502 SEI instrunction into the code.
1210 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1211 <tag/Declaration/<tt/void SEI (void);/
1212 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1213 so interrupts are disabled. Note that non maskable interrupts cannot be
1215 <tag/Notes/<itemize>
1216 <item>The function is actually a macro.
1217 <item>Disabling interrupts may lead to unexpected results.
1219 <tag/Availability/cc65
1221 <ref id="BRK" name="BRK">,
1222 <ref id="CLI" name="CLI">
1228 <sect1>abort<label id="abort"><p>
1232 <tag/Function/Terminates a program abnormally.
1233 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1234 <tag/Declaration/<tt/void abort (void);/
1235 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1236 on stderr, then terminates the program with an exit code of 3.
1237 <tag/Availability/ISO 9899
1239 <ref id="assert" name="assert">,
1240 <ref id="exit" name="exit">,
1241 <ref id="raise" name="raise">
1247 <sect1>abs<label id="abs"><p>
1251 <tag/Function/Returns the absolute value of an integer.
1252 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1253 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1254 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1256 <tag/Notes/<itemize>
1257 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1258 <item>The function is only available as fastcall function, so it may only be
1259 used in presence of a prototype.
1261 <tag/Availability/ISO 9899
1263 <ref id="labs" name="labs">
1269 <sect1>assert<label id="assert"><p>
1273 <tag/Function/Test a condition and possibly abort.
1274 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1275 <tag/Declaration/<tt/void assert (int cond);/
1276 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1277 statement. If the condition evaluates t zero (false), assert prints a message
1278 on stderr and aborts the program.
1279 <tag/Notes/<itemize>
1280 <item>The function is actually a macro.
1282 <tag/Availability/ISO 9899
1284 <ref id="abort" name="abort">,
1285 <ref id="exit" name="exit">
1291 <sect1>atexit<label id="atexit"><p>
1295 <tag/Function/Register an exit function.
1296 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1297 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1298 <tag/Description/<tt/atexit/ registers the function pointed to by
1299 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1300 terminates, they are called in LIFO order (the last function registered is
1301 called first). <tt/atexit/ returns zero on success and a nonzero value on
1303 <tag/Notes/<itemize>
1304 <item>A maximum of 5 exit functions can be registered.
1305 <item>There is no way to unregister an exit function.
1306 <item>The function is only available as fastcall function, so it may only be
1307 used in presence of a prototype.
1309 <tag/Availability/ISO 9899
1311 <ref id="abort" name="abort">,
1312 <ref id="exit" name="exit">
1318 <sect1>atmos_load<label id="atmos_load"><p>
1322 <tag/Function/Load Atmos tape.
1323 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1324 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1325 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1326 <tag/Availability/cc65
1328 <ref id="atmos_save" name="atmos_save">
1334 <sect1>atmos_save<label id="atmos_save"><p>
1338 <tag/Function/Save Atmos tape.
1339 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1340 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1341 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1342 <tag/Availability/cc65
1344 <ref id="atmos_load" name="atmos_load">
1346 atmos_save("hires", 0xa000, 0xc000);
1352 <sect1>atoi<label id="atoi"><p>
1356 <tag/Function/Convert a string to an integer.
1357 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1358 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1359 <tag/Description/<tt/atoi/ converts the given string into an integer.
1360 Conversion stops as soon as any invalid character is encountered.
1361 <tag/Notes/<itemize>
1362 <item>There is no way to detect any conversion errors.
1363 <item>The function does not check for an numerical overflow when converting.
1364 <item>The function is only available as fastcall function, so it may only be
1365 used in presence of a prototype.
1367 <tag/Availability/ISO 9899
1369 <ref id="atol" name="atol">,
1370 <ref id="itoa" name="itoa">,
1371 <ref id="ltoa" name="ltoa">,
1372 <ref id="ultoa" name="ultoa">,
1373 <ref id="utoa" name="utoa">
1379 <sect1>atol<label id="atol"><p>
1383 <tag/Function/Convert a string to a long integer.
1384 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1385 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1386 <tag/Description/<tt/atol/ converts the given string into a long integer.
1387 Conversion stops as soon as any invalid character is encountered.
1388 <tag/Notes/<itemize>
1389 <item>There is no way to detect any conversion errors.
1390 <item>The function does not check for an numerical overflow when converting.
1391 <item>The function is only available as fastcall function, so it may only be
1392 used in presence of a prototype.
1394 <tag/Availability/ISO 9899
1396 <ref id="atoi" name="atoi">,
1397 <ref id="itoa" name="itoa">,
1398 <ref id="ltoa" name="ltoa">,
1399 <ref id="ultoa" name="ultoa">,
1400 <ref id="utoa" name="utoa">
1406 <sect1>bgcolor<label id="bgcolor"><p>
1410 <tag/Function/Set the background text color.
1411 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1412 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1413 <tag/Description/The function will set a new background color and return the
1414 old (current) one. The background color is valid for the whole text output
1415 area of the screen, not just for new text.
1416 <tag/Notes/<itemize>
1417 <item>Background colors are system dependent. The function may have no effect
1418 on systems where the background color cannot be changed.
1419 <item>The function is only available as fastcall function, so it may only be
1420 used in presence of a prototype.
1422 <tag/Availability/cc65
1424 <ref id="bordercolor" name="bordercolor">,
1425 <ref id="textcolor" name="textcolor">
1431 <sect1>bordercolor<label id="bordercolor"><p>
1435 <tag/Function/Set the border (frame) color.
1436 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1437 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1438 <tag/Description/The function will set a new border color. It returns the old
1439 (current) border color.
1440 <tag/Notes/<itemize>
1441 <item>Border colors are system dependent. The function may have no effect
1442 on systems where the border color cannot be changed.
1443 <item>The function is only available as fastcall function, so it may only
1444 be used in presence of a prototype.
1446 <tag/Availability/cc65
1448 <ref id="bgcolor" name="bgcolor">,
1449 <ref id="textcolor" name="textcolor">
1455 <sect1>bsearch<label id="bsearch"><p>
1459 <tag/Function/Do a binary search in a sorted array.
1460 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1461 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1462 const void* base, size_t n, size_t size,
1463 int (*cmp) (const void*, const void*));/
1464 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1465 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1466 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1467 the function used to compare the members against the key. The function returns
1468 a pointer to the member found, or <tt/NULL/ if there was no match.
1469 <tag/Notes/<itemize>
1470 <item>The contents of the array must be sorted in ascending order according to
1471 the compare function given.
1472 <item>If there are multiple members that match the key, the function will
1473 return one of the members.
1474 <item>The function is only available as fastcall function, so it may only
1475 be used in presence of a prototype.
1477 <tag/Availability/ISO 9899
1479 <ref id="qsort" name="qsort">
1485 <sect1>bzero<label id="bzero"><p>
1489 <tag/Function/Fill a memory area with zeroes.
1490 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1491 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1492 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1494 <tag/Notes/<itemize>
1495 <item>The function is non standard and therefore only available in non ANSI
1496 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1497 <item>The function is only available as fastcall function, so it may only
1498 be used in presence of a prototype.
1500 <tag/Availability/cc65
1502 <ref id="_swap" name="_swap">,
1503 <ref id="memcpy" name="memcpy">,
1504 <ref id="memmove" name="memmove">,
1505 <ref id="memset" name="memset">,
1511 <sect1>c64mode<label id="c64mode"><p>
1515 <tag/Function/Switch the C128 into C64 compatible mode.
1516 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1517 <tag/Declaration/<tt/void c64mode (void);/
1518 <tag/Description/The function will cause the machine to reboot into C64 mode.
1519 <tag/Notes/<itemize>
1520 <item>The function is specific to the C128.
1521 <item>The function will not return to the caller.
1523 <tag/Availability/C128
1529 <sect1>calloc<label id="calloc"><p>
1533 <tag/Function/Allocate and clear memory.
1534 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1535 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1536 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1537 of size <tt/size/, clears the whole block with binary zeroes and returns a
1538 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1540 <tag/Notes/<itemize>
1541 <item>Clearing the memory may not have the expected effect on all platforms:
1542 pointers in the block may not be <tt/NULL/ and floating point variables may
1543 not be zero (0.0). In other words: The "clearing" effect of this function
1544 should be used with care for portable programs.
1545 <item>The function is only available as fastcall function, so it may only
1546 be used in presence of a prototype.
1548 <tag/Availability/ISO 9899
1550 <ref id="_heapadd" name="_heapadd">,
1551 <ref id="_heapblocksize" name="_heapblocksize">,
1552 <ref id="_heapmaxavail" name="_heapmaxavail">,
1553 <ref id="_heapmemavail" name="_heapmemavail">,
1554 <ref id="free" name="free">,
1555 <ref id="malloc" name="malloc">,
1556 <ref id="realloc" name="realloc">
1562 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1566 <tag/Function/Input byte from serial bus
1567 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1568 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1569 <tag/Description/The function returns a byte of data, which it
1570 gets from the current TALKer on the serial bus.
1571 In order to receive the data, the device must have previously been
1572 sent a command to TALK and a secondary address if it needs one.
1573 <tag/Notes/<itemize>
1576 <tag/Availability/cc65
1578 <ref id="cbm_k_talk" name="cbm_k_talk">,
1584 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1588 <tag/Function/Input a Character from the Current Device
1589 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1590 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1591 <tag/Description/The function returns a character from the current input device.
1592 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1593 When this function is called, the next byte of data available from the device is returned.
1594 Exception is the routine for the keyboard device (which is the default input device).
1595 <tag/Notes/<itemize>
1598 <tag/Availability/cc65
1600 <ref id="cbm_k_open" name="cbm_k_open">,
1601 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1607 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1611 <tag/Function/Output a byte
1612 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1613 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1614 <tag/Description/Function sends the character to the current output device.
1615 Unless a device has been OPENed and designated as the
1616 current output channel using the CHKOUT routine, the character is
1617 printed to the screen, which is the default output device. If the
1618 cassette is the current device, outputting a byte will only add it to
1619 the buffer. No actual transmission of data will occur until the
1620 192-byte buffer is full.
1621 <tag/Notes/<itemize>
1622 <item>The function is only available as fastcall function, so it may
1623 only be used in presence of a prototype.
1625 <tag/Availability/cc65
1627 <ref id="cbm_k_open" name="cbm_k_open">,
1628 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1634 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1638 <tag/Function/Designate a Logical File As the Current Input Channel
1639 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1640 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1641 <tag/Description/If you wish to
1642 get data from any device other than the keyboard, this function must be
1643 called after OPENing the device, before you can get a data byte with
1644 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1645 the logical file whose file number was supplied as the
1646 current file, its device as the current device, and its secondary
1647 address as the current secondary address. If the device on the
1648 channel is a serial device, which requires a TALK command and
1649 sometimes a secondary address, function will send them over the
1651 <tag/Notes/<itemize>
1652 <item>The function is only available as fastcall function, so it may
1653 only be used in presence of a prototype.
1655 <tag/Availability/cc65
1657 <ref id="cbm_k_open" name="cbm_k_open">,
1658 <ref id="cbm_k_basin" name="cbm_k_basin">,
1659 <ref id="cbm_k_getin" name="cbm_k_getin">
1665 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1669 <tag/Function/Transmit a byte over the serial bus
1670 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1671 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1672 <tag/Description/Purpose of this function is to send a byte of data over
1673 the serial bus. In order for the data to be received, the serial
1674 device must have first been commanded to LISTEN and been given a
1675 secondary address if necessary. This routine always buffers the
1676 current character, and defers sending it until the next byte is
1677 buffered. When the UNLISTEN command is sent, the last byte will be
1678 sent with an End or Identify (EOI).
1679 <tag/Notes/<itemize>
1680 <item>The function is only available as fastcall function, so it may
1681 only be used in presence of a prototype.
1683 <tag/Availability/cc65
1685 <ref id="cbm_k_listen" name="cbm_k_listen">,
1686 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1692 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1696 <tag/Function/Designate a Logical File As the Current Output Channel
1697 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1698 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1699 <tag/Description/If you wish to
1700 output data to any device other than the screen, this routine must be
1701 called after OPENing the device, and before you output a data byte
1702 with the cbm_k_bsout() function. When called, the function will designate the
1703 logical file whose file number was supplied as the current
1704 file, its device as the current device, and its secondary address as
1705 the current secondary address. If the device on the channel uses the
1706 serial bus, and therefore requires a LISTEN command and possibly a
1707 secondary address, this information will be sent on the bus.
1708 <tag/Notes/<itemize>
1709 <item>The function is only available as fastcall function, so it may
1710 only be used in presence of a prototype.
1712 <tag/Availability/cc65
1714 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1715 <ref id="cbm_k_listen" name="cbm_k_listen">
1721 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1725 <tag/Function/Close All Logical I/O Files
1726 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1727 <tag/Declaration/<tt/void cbm_k_clall (void);/
1728 <tag/Description/It closes all
1729 open files, by resetting the index into open files to
1730 zero and restores the default I/O devices.
1731 <tag/Notes/<itemize>
1734 <tag/Availability/cc65
1736 <ref id="cbm_k_open" name="cbm_k_open">,
1737 <ref id="cbm_k_close" name="cbm_k_close">
1743 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1747 <tag/Function/Close a Logical I/O File
1748 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1749 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1750 <tag/Description/It is used to
1751 close a logical file after all I/O operations involving that file have
1753 <tag/Notes/<itemize>
1754 <item>The function is only available as fastcall function, so it may
1755 only be used in presence of a prototype.
1757 <tag/Availability/cc65
1759 <ref id="cbm_k_open" name="cbm_k_open">,
1760 <ref id="cbm_k_clall" name="cbm_k_clall">
1766 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1770 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1771 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1772 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1773 <tag/Description/It sets the
1774 current input device to the keyboard, and the current output device to
1775 the screen. Also, if the current input device was formerly a serial
1776 device, the routine sends it an UNTALK command on the serial bus, and
1777 if a serial device was formerly the current output device, the routine
1778 sends it an UNLISTEN command.
1779 <tag/Notes/<itemize>
1782 <tag/Availability/cc65
1784 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
1785 <ref id="cbm_k_ckout" name="cbm_k_ckout">
1791 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
1795 <tag/Function/Get One Byte from the Input Device
1796 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1797 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
1798 <tag/Description/Function gets a character from the current input device.
1799 <tag/Notes/<itemize>
1802 <tag/Availability/cc65
1804 <ref id="cbm_k_basin" name="cbm_k_basin">
1810 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
1814 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
1815 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1816 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
1817 <tag/Description/This function returns the address of
1818 the memory section where the memory mapped I/O devices are located. This
1819 address can then be used with an offset to access the memory mapped I/O
1820 devices in the Commodore 64. The offset is the number of locations from
1821 the beginning of the page on which the I/O register you want is located.
1822 This function exists to provide compatibility between the Commodore 64,
1823 VIC-20, and future models of the Commodore 64. If the I/O locations for
1824 a program are set by a call to this function, they should
1825 still remain compatible with future versions of the Commodore 64, the
1827 <tag/Notes/<itemize>
1830 <tag/Availability/cc65
1838 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
1842 <tag/Function/Command a device on the serial bus to LISTEN
1843 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1844 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
1845 <tag/Description/This function will command a device on the serial bus to
1846 receive data. The KERNAL routine will OR the supplied device number bit by bit
1847 to convert it to a listen address, then transmits this data as a command on
1848 the serial bus. The specified device will then go into listen mode, and
1849 be ready to accept information.
1850 <tag/Notes/<itemize>
1851 <item>The function is only available as fastcall function, so it may
1852 only be used in presence of a prototype.
1854 <tag/Availability/cc65
1856 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
1862 <sect1>cbm_k_load<label id="cbm_k_load"><p>
1866 <tag/Function/Load RAM from a Device
1867 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1868 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
1869 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
1870 It can also be used for a verify operation, comparing data from a device with the data already in
1871 memory, while leaving the data stored in RAM unchanged.
1872 The flag must be set to 0 for a LOAD operation, or 1 for a
1873 verify, If the input device is OPENed with a secondary address (SA) of 0
1874 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
1875 If the device is addressed with a secondary address of 1, then the data is
1876 loaded into memory starting at the location specified by the header.
1877 Function returns the address of the highest RAM location loaded.
1878 Before this function can be called, the KERNAL SETLFS, and SETNAM
1879 routines must be called.
1880 <tag/Notes/<itemize>
1881 <item>The function is only available as fastcall function, so it may
1882 only be used in presence of a prototype.
1884 <tag/Availability/cc65
1886 <ref id="cbm_k_save" name="cbm_k_save">,
1887 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1888 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1894 <sect1>cbm_k_open<label id="cbm_k_open"><p>
1898 <tag/Function/Open a Logical I/O File
1899 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1900 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
1901 <tag/Description/This function assigns a logical file to a device, so that it can be used for
1902 Input/Output operations. In order to specify the logical file number,
1903 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
1904 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
1905 functions are called, cbm_k_open() is then called.
1906 <tag/Notes/<itemize>
1909 <tag/Availability/cc65
1911 <ref id="cbm_k_close" name="cbm_k_close">,
1912 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1913 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1919 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
1923 <tag/Function/Read status word
1924 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1925 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
1926 <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.
1927 <tag/Notes/<itemize>
1930 <tag/Availability/cc65
1938 <sect1>cbm_k_save<label id="cbm_k_save"><p>
1942 <tag/Function/Save RAM to a Device
1943 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1944 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
1945 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
1946 used before calling this function. However, a file name is not required to
1947 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
1948 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.
1949 <tag/Notes/<itemize>
1950 <item>The function is only available as fastcall function, so it may
1951 only be used in presence of a prototype.
1953 <tag/Availability/cc65
1955 <ref id="cbm_k_load" name="cbm_k_load">,
1956 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1957 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1963 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
1967 <tag/Function/Set up a logical file
1968 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1969 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
1970 <tag/Description/This functions sets up the logical file by setting its number, device address,
1971 and secondary address.
1972 <tag/Notes/<itemize>
1973 <item>The function is only available as fastcall function, so it may
1974 only be used in presence of a prototype.
1976 <tag/Availability/cc65
1978 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1984 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
1988 <tag/Function/Set Filename Parameters
1989 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1990 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
1991 <tag/Description/This function is used to set up the file name for the OPEN,
1992 SAVE, or LOAD operations.
1993 <tag/Notes/<itemize>
1994 <item>The function is only available as fastcall function, so it may
1995 only be used in presence of a prototype.
1997 <tag/Availability/cc65
1999 <ref id="cbm_k_open" name="cbm_k_open">,
2000 <ref id="cbm_k_load" name="cbm_k_load">,
2001 <ref id="cbm_k_save" name="cbm_k_save">
2007 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2011 <tag/Function/Commands device to TALK
2012 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2013 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2014 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2015 bus. This commands the device to TALK.
2016 <tag/Notes/<itemize>
2017 <item>The function is only available as fastcall function, so it may
2018 only be used in presence of a prototype.
2020 <tag/Availability/cc65
2022 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2028 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2032 <tag/Function/Send an UNLISTEN command
2033 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2034 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2035 <tag/Description/This function commands all devices on the serial bus to
2036 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2037 function results in an UNLISTEN command being transmitted on the serial
2038 bus. Only devices previously commanded to LISTEN are affected. This
2039 function is normally used after the host computer is finished sending data
2040 to external devices. Sending the UNLISTEN commands the listening devices
2041 to get off the serial bus so it can be used for other purposes.
2042 <tag/Notes/<itemize>
2045 <tag/Availability/cc65
2047 <ref id="cbm_k_listen" name="cbm_k_listen">
2053 <sect1>cclear<label id="cclear"><p>
2057 <tag/Function/Clear part of a line (write a given number of spaces).
2058 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2059 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2060 <tag/Description/The function clears part of a line by writing <tt/length/
2061 spaces in the current text color.
2062 <tag/Notes/<itemize>
2063 <item>The function is only available as fastcall function, so it may
2064 only be used in presence of a prototype.
2066 <tag/Availability/cc65
2068 <ref id="cclearxy" name="cclearxy">,
2069 <ref id="clrscr" name="clrscr">
2075 <sect1>cclearxy<label id="cclearxy"><p>
2079 <tag/Function/Clear part of a line (write a given number of spaces) starting
2080 at a specific screen position.
2081 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2082 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2083 <tag/Description/The function moves the cursor to a specific position, and
2084 will then clear part of the line by writing <tt/length/ spaces in the current
2086 <tag/Notes/<itemize>
2087 <item>The function is only available as fastcall function, so it may
2088 only be used in presence of a prototype.
2090 <tag/Availability/cc65
2092 <ref id="cclear" name="cclear">,
2093 <ref id="clrscr" name="clrscr">
2099 <sect1>cgetc<label id="cgetc"><p>
2103 <tag/Function/Read a character from the keyboard.
2104 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2105 <tag/Declaration/<tt/char cgetc (void);/
2106 <tag/Description/The function reads a character from the keyboard. If there is
2107 no character available, <tt/cgetc/ waits until the user presses a key. If the
2108 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2109 displayed while waiting.
2110 <tag/Notes/<itemize>
2111 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
2112 from this buffer and wait only if the buffer is empty.
2114 <tag/Availability/cc65
2116 <ref id="cursor" name="cursor">,
2117 <ref id="kbhit" name="kbhit">
2123 <sect1>chline<label id="chline"><p>
2127 <tag/Function/Output a horizontal line in text mode.
2128 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2129 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2130 <tag/Description/The function outputs a horizontal line with the given length
2131 starting at the current cursor position.
2132 <tag/Notes/<itemize>
2133 <item>The character used to draw the horizontal line is system dependent.
2134 If available, a line drawing character is used. Drawing a line that is partially
2135 off screen leads to undefined behaviour.
2136 <item>The function is only available as fastcall function, so it may only be
2137 used in presence of a prototype.
2139 <tag/Availability/cc65
2141 <ref id="chlinexy" name="chlinexy">,
2142 <ref id="cvline" name="cvline">,
2143 <ref id="cvlinexy" name="cvlinexy">
2149 <sect1>chlinexy<label id="chlinexy"><p>
2153 <tag/Function/Output a horizontal line at a given position in text mode.
2154 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2155 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2156 <tag/Description/The function outputs a horizontal line with the given length
2157 starting at a given position.
2158 <tag/Notes/<itemize>
2159 <item>The character used to draw the horizontal line is system dependent.
2160 If available, a line drawing character is used. Drawing a line that is partially
2161 off screen leads to undefined behaviour.
2162 <item>The function is only available as fastcall function, so it may only be
2163 used in presence of a prototype.
2165 <tag/Availability/cc65
2167 <ref id="chline" name="chline">,
2168 <ref id="cvline" name="cvline">,
2169 <ref id="cvlinexy" name="cvlinexy">
2175 <sect1>clearerr<label id="clearerr"><p>
2179 <tag/Function/Clear error and end-of-file status of a stream.
2180 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2181 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2182 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2183 indicators for the stream <tt/f/.
2184 <tag/Notes/<itemize>
2185 <item>The function is only available as fastcall function, so it may only be
2186 used in presence of a prototype.
2188 <tag/Availability/ISO 9899
2190 <ref id="feof" name="feof">,
2191 <ref id="ferror" name="ferror">
2197 <sect1>clock<label id="clock"><p>
2201 <tag/Function/Determine the processor time used.
2202 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2203 <tag/Declaration/<tt/clock_t clock (void);/
2204 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2205 time used by the program. The time is returned in implementation defined
2206 units. It can be converted to seconds by dividing by the value of the macro
2207 <tt/CLOCKS_PER_SEC/.
2208 <tag/Notes/<itemize>
2209 <item>Since the machines, cc65 generated programs run on, cannot run multiple
2210 processes, the function will actually return the time since some
2211 implementation defined point in the past.
2213 <tag/Availability/ISO 9899
2215 <ref id="time" name="time">
2221 <sect1>clrscr<label id="clrscr"><p>
2225 <tag/Function/Clear the text screen.
2226 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2227 <tag/Declaration/<tt/void clrscr (void);/
2228 <tag/Description/The function clears the text screen and moves the cursor to
2229 the upper left corner.
2230 <tag/Availability/cc65
2232 <ref id="cclear" name="cclear">,
2233 <ref id="cclearxy" name="cclearxy">
2239 <sect1>close<label id="close"><p>
2243 <tag/Function/Close a file descriptor.
2244 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2245 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2246 <tag/Description/The function closes the given file descriptor. It returns zero
2247 on success and -1 on error. If an error occurs, the cause can be determined by
2248 reading the <tt/errno/ variable.
2249 <tag/Notes/<itemize>
2250 <item>The function is only available as fastcall function, so it may only
2251 be used in presence of a prototype.
2253 <tag/Availability/POSIX 1003.1
2255 <ref id="creat" name="creat">,
2256 <ref id="open" name="open">
2262 <sect1>closedir<label id="closedir"><p>
2266 <tag/Function/Close a directory.
2267 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2268 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2269 <tag/Description/The function closes the given directory descriptor. It returns
2270 zero on success and -1 on error. If an error occurs, the cause can be determined
2271 by reading the <tt/errno/ variable.
2272 <tag/Notes/<itemize>
2273 <item>The function is only available as fastcall function, so it may only
2274 be used in presence of a prototype.
2276 <tag/Availability/POSIX 1003.1
2278 <ref id="opendir" name="opendir">,
2279 <ref id="readdir" name="readdir">
2285 <sect1>creat<label id="creat"><p>
2289 <tag/Function/Create a file.
2290 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2291 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2292 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2293 associated with it. On error, -1 is returned and an error code is stored in
2295 <tag/Notes/<itemize>
2296 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2297 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2298 <item>The function is only available as fastcall function, so it may only
2299 be used in presence of a prototype.
2301 <tag/Availability/POSIX 1003.1
2303 <ref id="close" name="close">,
2304 <ref id="open" name="open">
2310 <sect1>cprintf<label id="cprintf"><p>
2314 <tag/Function/Formatted output to the console.
2315 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2316 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2317 <tag/Description/The arguments are converted to text where necessary and
2318 formatted according to the format string given. The resulting string is output
2319 to the console. <tt/cprintf/ supports the same format specifiers as
2320 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2321 <tag/Notes/<itemize>
2322 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2323 between <tt/\r/ and <tt/\n/.
2325 <tag/Availability/cc65
2327 <ref id="cputc" name="cputc">,
2328 <ref id="cputcxy" name="cputcxy">,
2329 <ref id="cputs" name="cputs">,
2330 <ref id="cputsxy" name="cputsxy">,
2331 <ref id="vcprintf" name="vcprintf">
2337 <sect1>cputc<label id="cputc"><p>
2341 <tag/Function/Output a character directly to the console.
2342 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2343 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2344 <tag/Description/Output one character to the console at the current cursor
2346 <tag/Notes/<itemize>
2347 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2348 between <tt/\r/ and <tt/\n/.
2349 <item>The function is only available as fastcall function, so it may only
2350 be used in presence of a prototype.
2352 <tag/Availability/cc65
2354 <ref id="cprintf" name="cprintf">,
2355 <ref id="cputcxy" name="cputcxy">,
2356 <ref id="cputs" name="cputs">,
2357 <ref id="cputsxy" name="cputsxy">,
2358 <ref id="vcprintf" name="vcprintf">
2364 <sect1>cputcxy<label id="cputcxy"><p>
2368 <tag/Function/Output a character at a specific screen position.
2369 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2370 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2371 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2372 the screen and outputs one character.
2373 <tag/Notes/<itemize>
2374 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2375 between <tt/\r/ and <tt/\n/.
2376 <item>The function is only available as fastcall function, so it may only
2377 be used in presence of a prototype.
2379 <tag/Availability/cc65
2381 <ref id="cprintf" name="cprintf">,
2382 <ref id="cputc" name="cputc">,
2383 <ref id="cputs" name="cputs">,
2384 <ref id="cputsxy" name="cputsxy">,
2385 <ref id="vcprintf" name="vcprintf">
2391 <sect1>cputs<label id="cputs"><p>
2395 <tag/Function/Output a string directly to the console.
2396 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2397 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2398 <tag/Description/The function outputs the given string on the console at the
2399 current cursor position.
2400 <tag/Notes/<itemize>
2401 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2402 between <tt/\r/ and <tt/\n/.
2403 <item>The function is only available as fastcall function, so it may only
2404 be used in presence of a prototype.
2406 <tag/Availability/cc65
2408 <ref id="cprintf" name="cprintf">,
2409 <ref id="cputc" name="cputc">,
2410 <ref id="cputcxy" name="cputcxy">,
2411 <ref id="cputsxy" name="cputsxy">,
2412 <ref id="vcprintf" name="vcprintf">
2418 <sect1>cputsxy<label id="cputsxy"><p>
2422 <tag/Function/Output a string to the console at a given position.
2423 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2424 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2425 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2426 and outputs the string <tt/s/.
2427 <tag/Notes/<itemize>
2428 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2429 between <tt/\r/ and <tt/\n/.
2430 <item>The function is only available as fastcall function, so it may only
2431 be used in presence of a prototype.
2433 <tag/Availability/cc65
2435 <ref id="cprintf" name="cprintf">,
2436 <ref id="cputc" name="cputc">,
2437 <ref id="cputcxy" name="cputcxy">,
2438 <ref id="cputs" name="cputs">,
2439 <ref id="vcprintf" name="vcprintf">
2445 <sect1>cursor<label id="cursor"><p>
2449 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2450 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2451 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2452 <tag/Description/If the argument to the function is non zero, a blinking cursor
2453 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2454 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2455 <tag/Notes/<itemize>
2456 <item>The function is only available as fastcall function, so it may only
2457 be used in presence of a prototype.
2459 <tag/Availability/cc65
2461 <ref id="cgetc" name="cgetc">,
2462 <ref id="kbhit" name="kbhit">
2468 <sect1>cvline<label id="cvline"><p>
2472 <tag/Function/Output a vertical line in text mode.
2473 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2474 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2475 <tag/Description/The function outputs a vertical line with the given length
2476 starting at the current cursor position.
2477 <tag/Notes/<itemize>
2478 <item>The character used to draw the vertical line is system dependent.
2479 If available, a line drawing character is used. Drawing a line that is partially
2480 off screen leads to undefined behaviour.
2481 <item>The function is only available as fastcall function, so it may only be
2482 used in presence of a prototype.
2484 <tag/Availability/cc65
2486 <ref id="chline" name="chline">,
2487 <ref id="chlinexy" name="chlinexy">,
2488 <ref id="cvlinexy" name="cvlinexy">
2494 <sect1>cvlinexy<label id="cvlinexy"><p>
2498 <tag/Function/Output a vertical line at a given position in text mode.
2499 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2500 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2501 <tag/Description/The function outputs a vertical line with the given length
2502 starting at a given position.
2503 <tag/Notes/<itemize>
2504 <item>The character used to draw the vertical line is system dependent.
2505 If available, a line drawing character is used. Drawing a line that is partially
2506 off screen leads to undefined behaviour.
2507 <item>The function is only available as fastcall function, so it may only be
2508 used in presence of a prototype.
2510 <tag/Availability/cc65
2512 <ref id="chline" name="chline">,
2513 <ref id="chlinexy" name="chlinexy">,
2514 <ref id="cvline" name="cvline">
2520 <sect1>div<label id="div"><p>
2524 <tag/Function/Divide two ints and return quotient and remainder.
2525 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2526 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2527 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2528 quotient and remainder in a <tt/div_t/ structure.
2529 <tag/Notes/<itemize>
2530 <item>The function is only available as fastcall function, so it may only
2531 be used in presence of a prototype.
2533 <tag/Availability/ISO 9899
2541 <sect1>em_commit<label id="em_commit"><p>
2545 <tag/Function/Commit changes into extended memory.
2546 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2547 <tag/Declaration/<tt/void em_commit (void);/
2548 <tag/Description/Commit changes in the memory window to extended storage. If
2549 the contents of the memory window have been changed, these changes may be lost
2550 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
2551 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
2552 name="em_copyto">/ are called without calling <tt/em_commit/ first.
2553 <tag/Notes/<itemize>
2554 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
2555 memory window are discarded, it does just mean that the drivers is allowed
2557 <item>The function is only available as fastcall function, so it may only be
2558 used in presence of a prototype.
2559 <item>The function produces undefined results if no extended memory driver is
2562 <tag/Availability/cc65
2564 <ref id="em_load_driver" name="em_load_driver">,
2565 <ref id="em_map" name="em_map">,
2566 <ref id="em_use" name="em_use">
2572 <sect1>em_copyfrom<label id="em_copyfrom"><p>
2576 <tag/Function/Copy from extended into normal memory.
2577 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2578 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
2579 <tag/Description/Copy data from extended memory into linear memory. Source and
2580 target addresses as well as the number of bytes to transfer are specified in
2581 the <tt/em_copy/ structure that is passed as a parameter.
2582 <tag/Notes/<itemize>
2583 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
2584 made any changes to the data in the window, call <tt/<ref id="em_commit"
2585 name="em_commit">/ first, or the changes are lost.
2586 <item>The function is only available as fastcall function, so it may only be
2587 used in presence of a prototype.
2588 <item>The function produces undefined results if no extended memory driver is
2591 <tag/Availability/cc65
2593 <ref id="em_commit" name="em_commit">,
2594 <ref id="em_copyto" name="em_copyto">,
2595 <ref id="em_load_driver" name="em_load_driver">
2601 <sect1>em_copyto<label id="em_copyto"><p>
2605 <tag/Function/Copy from normal into extended memory.
2606 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2607 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
2608 <tag/Description/Copy data from linear into extended memory. Source and
2609 target addresses as well as the number of bytes to transfer are specified in
2610 the <tt/em_copy/ structure that is passed as a parameter.
2611 <tag/Notes/<itemize>
2612 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
2613 made any changes to the data in the window, call <tt/<ref id="em_commit"
2614 name="em_commit">/ first, or the changes are lost.
2615 <item>The function is only available as fastcall function, so it may only be
2616 used in presence of a prototype.
2617 <item>The function produces undefined results if no extended memory driver is
2620 <tag/Availability/cc65
2622 <ref id="em_commit" name="em_commit">,
2623 <ref id="em_copyfrom" name="em_copyfrom">,
2624 <ref id="em_load_driver" name="em_load_driver">
2630 <sect1>em_install<label id="em_install"><p>
2634 <tag/Function/Install an already loaded extended memory driver.
2635 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2636 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
2637 <tag/Description/The function installs an already loaded extended memory driver
2638 and returns an error code. The function may be used to install a driver linked
2639 statically to the program.
2640 <tag/Notes/<itemize>
2641 <item>Not all drivers are able to detect if the supported hardware is really
2643 <item>The function is only available as fastcall function, so it may only be
2644 used in presence of a prototype.
2646 <tag/Availability/cc65
2648 <ref id="em_load_driver" name="em_load_driver">,
2649 <ref id="em_uninstall" name="em_uninstall">,
2650 <ref id="em_unload" name="em_unload">
2656 <sect1>em_load_driver<label id="em_load_driver"><p>
2660 <tag/Function/Load and initialize an extended memory driver.
2661 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2662 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
2663 <tag/Description/Load an extended memory driver into memory and initialize
2664 it. The function returns an error code that tells if all this has been
2666 <tag/Notes/<itemize>
2667 <item>Not all drivers are able to detect if the supported hardware is really
2669 <item>The function is only available as fastcall function, so it may only be
2670 used in presence of a prototype.
2671 <item>The driver is loaded by name, so currently you must know the type of
2672 extended memory that should be supported. There is no autodetect capability.
2674 <tag/Availability/cc65
2676 <ref id="em_unload" name="em_unload">
2682 <sect1>em_map<label id="em_map"><p>
2686 <tag/Function/Make a page of extended memory accessible.
2687 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2688 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
2689 <tag/Description/The function maps one page of extended memory into linear
2690 memory and returns a pointer to the page frame. Depending on the hardware
2691 and driver, the data is either mapped into the address space or transfered
2692 into a buffer. If you don't need the actual contents of the page (for example
2693 because you're going to overwrite it completely), it is better to call
2694 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
2695 data if it is possible to avoid that.
2696 <tag/Notes/<itemize>
2697 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
2698 made any changes to the data in the window, call <tt/<ref id="em_commit"
2699 name="em_commit">/ first, or the changes are lost.
2700 <item>The function is only available as fastcall function, so it may only be
2701 used in presence of a prototype.
2702 <item>The function produces undefined results if no extended memory driver is
2705 <tag/Availability/cc65
2707 <ref id="em_commit" name="em_commit">,
2708 <ref id="em_load_driver" name="em_load_driver">,
2709 <ref id="em_use" name="em_use">
2715 <sect1>em_pagecount<label id="em_pagecount"><p>
2719 <tag/Function/Return the number of available extended memory pages.
2720 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2721 <tag/Declaration/<tt/unsigned em_pagecount (void);/
2722 <tag/Description/The function returns the size of the extended memory supported
2723 by the driver in 256 byte pages.
2724 <tag/Notes/<itemize>
2725 <item>The function returns zero if no extended memory driver is loaded.
2726 <item>The function may return zero if the supported hardware was not detected.
2728 <tag/Availability/cc65
2730 <ref id="em_load_driver" name="em_load_driver">
2736 <sect1>em_uninstall<label id="em_uninstall"><p>
2740 <tag/Function/Uninstall an already loaded extended memory driver.
2741 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2742 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
2743 <tag/Description/The function uninstalls an already loaded extended memory
2744 driver but doesn't remove it from memory.
2745 <tag/Notes/<itemize>
2746 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
2747 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
2748 should be used instead of <tt/em_uninstall/ so the driver is also removed
2751 <tag/Availability/cc65
2753 <ref id="em_install" name="em_install">,
2754 <ref id="em_load_driver" name="em_load_driver">,
2755 <ref id="em_unload" name="em_unload">
2761 <sect1>em_unload<label id="em_unload"><p>
2765 <tag/Function/Unload an extended memory driver.
2766 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2767 <tag/Declaration/<tt/unsigned char em_unload (void);/
2768 <tag/Description/The function unloads a loaded extended memory driver and
2769 frees all memory allocated for the driver.
2770 <tag/Notes/<itemize>
2771 <item>The function does nothing if no driver is loaded.
2773 <tag/Availability/cc65
2775 <ref id="em_load_driver" name="em_load_driver">
2781 <sect1>em_use<label id="em_use"><p>
2785 <tag/Function/Prepare an extended memory page for use.
2786 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2787 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
2788 <tag/Description/The function maps one page of extended memory into linear
2789 memory and returns a pointer to the page frame. This function is similar to
2790 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
2791 actual memory window in the assumption that the existing data is wrong or
2792 will get overwritten.
2793 <tag/Notes/<itemize>
2794 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
2795 made any changes to the data in the window, call <tt/<ref id="em_commit"
2796 name="em_commit">/ first, or the changes are lost.
2797 <item>The function is only available as fastcall function, so it may only be
2798 used in presence of a prototype.
2799 <item>The function produces undefined results if no extended memory driver is
2802 <tag/Availability/cc65
2804 <ref id="em_commit" name="em_commit">,
2805 <ref id="em_load_driver" name="em_load_driver">,
2806 <ref id="em_map" name="em_map">
2812 <sect1>exit<label id="exit"><p>
2816 <tag/Function/Terminate the program.
2817 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2818 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
2819 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
2820 return code of the program. Before termination, all files are closed, buffered
2821 output is written and any functions registered with <tt/<ref id="atexit"
2822 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
2823 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
2825 <tag/Notes/<itemize>
2826 <item>The function is only available as fastcall function, so it may only
2827 be used in presence of a prototype.
2828 <item>It depends on the host machine if the program return code can be
2829 evaluated or is ignored.
2831 <tag/Availability/ISO 9899
2833 <ref id="abort" name="abort">,
2834 <ref id="exit" name="exit">
2840 <sect1>exec<label id="exec"><p>
2844 <tag/Function/Execute a program file.
2845 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
2846 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
2847 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
2848 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
2849 then loading and starting the program named in the first argument, passing
2850 the command line specified as second argument. Instead of an empty string,
2851 a <tt/NULL/ pointer may be passed as second parameter.
2852 On success, the function does not return. On failure, -1 is returned and
2853 <tt/errno/ contains an error code.
2854 <tag/Notes/<itemize>
2855 <item>The function is only available as fastcall function, so it may only
2856 be used in presence of a prototype.
2857 <item>On most platforms, the function needs to copy a small stub loader to
2858 some memory area outside the program space. This may collide with other
2859 programs. See the platform specific docs on this.
2860 <item>Because it is necessary to terminate the running program before the
2861 memory can be reused to load the new one, there is a high chance that the
2862 function may not be able to return on errors.
2863 <item>The command line is passed to the new program in the same way as cc65
2864 programs expect the command line. If the new program is not a cc65 generated
2865 program, it may not be able to read it.
2867 <tag/Availability/cc65
2869 <ref id="exit" name="exit">
2875 <sect1>fast<label id="fast"><p>
2879 <tag/Function/Switch the C128 into 2MHz mode.
2880 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2881 <tag/Declaration/<tt/void fast (void);/
2882 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
2883 will nearly double the speed compared to slow mode.
2884 <tag/Notes/<itemize>
2885 <item>The function is specific to the C128.
2886 <item>2MHz clock will not work in 40 column mode.
2888 <tag/Availability/C128
2890 <ref id="slow" name="slow">,
2891 <ref id="toggle_videomode" name="toggle_videomode">,
2892 <ref id="videomode" name="videomode">
2898 <sect1>feof<label id="feof"><p>
2902 <tag/Function/Return the end-of-file indicator of a stream.
2903 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2904 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
2905 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
2906 <tt/f/, and returns a non zero value if it is set.
2907 <tag/Notes/<itemize>
2908 <item>The indicator is set only after a read past the end of a file is
2910 <item>The function is only available as fastcall function, so it may only be
2911 used in presence of a prototype.
2913 <tag/Availability/ISO 9899
2915 <ref id="feof" name="clearerr">,
2916 <ref id="ferror" name="ferror">
2922 <sect1>ferror<label id="ferror"><p>
2926 <tag/Function/Return the error indicator of a stream.
2927 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2928 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
2929 <tag/Description/<tt/ferror/ tests the error indicator of the stream
2930 <tt/f/, and returns a non zero value if it is set.
2931 <tag/Notes/<itemize>
2932 <item>The function is only available as fastcall function, so it may only be
2933 used in presence of a prototype.
2935 <tag/Availability/ISO 9899
2937 <ref id="feof" name="clearerr">,
2938 <ref id="ferror" name="feof">
2944 <sect1>fileno<label id="fileno"><p>
2948 <tag/Function/Return the file handle used by a stream.
2949 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2950 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
2951 <tag/Description/The <tt/fileno/ function returns the file handle used
2952 internally by a C stream. This file handle (an integer) can be used as a
2953 handle for the POSIX input/output functions.
2954 <tag/Notes/<itemize>
2955 <item>The function is only available as fastcall function, so it may only be
2956 used in presence of a prototype.
2957 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
2958 file may have unpredictable results.
2960 <tag/Availability/POSIX 1003.1
2962 <ref id="creat" name="creat">,
2963 <ref id="open" name="open"> <!-- , -->
2964 <!-- <ref id="read" name="read">, -->
2965 <!-- <ref id="write" name="write"> -->
2971 <sect1>free<label id="free"><p>
2975 <tag/Function/Free a block of dynamic memory.
2976 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2977 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
2978 <tag/Description/Free a block of dynamic memory previously allocated with
2979 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
2980 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
2981 pointer is <tt/NULL/, no action is performed.
2982 <tag/Notes/<itemize>
2983 <item>Passing an already free'd block to <tt/free/ again will cause undefined
2984 behaviour and may crash your program.
2985 <item>The function is only available as fastcall function, so it may only
2986 be used in presence of a prototype.
2988 <tag/Availability/ISO 9899
2990 <ref id="_heapadd" name="_heapadd">,
2991 <ref id="_heapblocksize" name="_heapblocksize">,
2992 <ref id="_heapmaxavail" name="_heapmaxavail">,
2993 <ref id="_heapmemavail" name="_heapmemavail">,
2994 <ref id="calloc" name="calloc">,
2995 <ref id="malloc" name="malloc">,
2996 <ref id="realloc" name="realloc">
3002 <sect1>get_ostype<label id="get_ostype"><p>
3006 <tag/Function/The function returns the operating system, the program runs on.
3007 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3008 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3009 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3010 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3011 all supported targets. If it exists, it returns a number that identifies the
3012 operating system or machine type, the program runs on. The machine dependent
3013 header files define constants that can be used to check the return code.
3014 <tag/Notes/<itemize>
3015 <item>The function does not exist on all platforms.
3016 <item>The return codes are platform dependent.
3018 <tag/Availability/cc65 (not all platforms)
3024 <sect1>getcpu<label id="getcpu"><p>
3028 <tag/Function/Determine on which CPU the program is running.
3029 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3030 <tag/Declaration/<tt/unsigned char getcpu (void);/
3031 <tag/Description/The function checks on which CPU the code is running. It
3032 returns one of the constants<itemize>
3034 <item><tt/CPU_65C02/
3035 <item><tt/CPU_65816/
3037 <tag/Notes/<itemize>
3038 <item>Other, more exotic CPU types are not disinguished.
3040 <tag/Availability/cc65
3046 <sect1>getenv<label id="getenv"><p>
3050 <tag/Function/Return a value from the environment.
3051 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3052 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3053 <tag/Description/The function searches the environment for an entry that
3054 matches <tt/name/ and returns its value. The environment consists of a list
3055 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3057 <tag/Notes/<itemize>
3058 <item>What exactly is stored in the environment depends on the machine the
3059 program is running on.
3060 <item>The function is only available as fastcall function, so it may only
3061 be used in presence of a prototype.
3063 <tag/Availability/ISO 9899
3069 <sect1>getopt<label id="getopt"><p>
3073 <tag/Function/Parse command line options.
3074 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3075 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3076 const char* optstring);/
3077 <tag/Description/The function parses command line arguments, <tt/argc/ and
3078 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3079 is a string that contains command line option characters. If a character in
3080 <tt/optstring/ is followed by a colon, the option requires an argument. An
3081 option on the command line is recognized if it is one of the option characters
3083 <tt/getopt/ must be called repeatedly. It will return each option character
3084 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3085 option argument is placed in <tt/optarg/, the index of the next element on the
3086 command line to be processed is placed in <tt/optind/.
3087 <tag/Notes/<itemize>
3088 <item>The implementation will not reorder options. A non option on the command
3089 line will terminate option processing. All remaining arguments are not
3090 recognized as options, even if the start with a '-' character.
3091 <item>The function is only available as fastcall function, so it may only
3092 be used in presence of a prototype.
3094 <tag/Availability/POSIX.2
3100 <sect1>gotox<label id="gotox"><p>
3104 <tag/Function/Move the text mode cursor to a new X position.
3105 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3106 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3107 <tag/Description/The function moves the text mode cursor to the specified X
3108 position while leaving the Y position untouched. The leftmost position on the
3109 screen has the coordinate 0.
3110 <tag/Notes/<itemize>
3111 <item>The function is only available as fastcall function, so it may
3112 only be used in presence of a prototype.
3113 <item>Invalid values for the X position (out of screen coordinates) may
3114 lead to undefined behaviour.
3116 <tag/Availability/cc65
3118 <ref id="gotoy" name="gotoy">,
3119 <ref id="gotoxy" name="gotoxy">,
3120 <ref id="wherex" name="wherex">,
3121 <ref id="wherey" name="wherey">
3127 <sect1>gotoxy<label id="gotoxy"><p>
3131 <tag/Function/Move the text mode cursor to a new position.
3132 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3133 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3134 <tag/Description/The function moves the text mode cursor to the specified
3135 position. The leftmost position on the screen has the X coordinate 0, the
3136 topmost line has the Y coordinate 0.
3137 <tag/Notes/<itemize>
3138 <item>The function is only available as fastcall function, so it may only be
3139 used in presence of a prototype.
3140 <item>Invalid values for any of both coordinates (out of screen positions) may
3141 lead to undefined behaviour.
3143 <tag/Availability/cc65
3145 <ref id="gotox" name="gotox">,
3146 <ref id="gotoy" name="gotoy">,
3147 <ref id="wherex" name="wherex">,
3148 <ref id="wherey" name="wherey">
3154 <sect1>gotoy<label id="gotoy"><p>
3158 <tag/Function/Move the text mode cursor to a new Y position.
3159 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3160 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3161 <tag/Description/The function moves the text mode cursor to the specified Y
3162 position while leaving the X position untouched. The uppermost position on the
3163 screen has the coordinate 0.
3164 <tag/Notes/<itemize>
3165 <item>The function is only available as fastcall function, so it may
3166 only be used in presence of a prototype.
3167 <item>Invalid values for the Y position (out of screen coordinates) may lead
3168 to undefined behaviour.
3170 <tag/Availability/cc65
3172 <ref id="gotox" name="gotox">,
3173 <ref id="gotoxy" name="gotoxy">,
3174 <ref id="wherex" name="wherex">,
3175 <ref id="wherey" name="wherey">
3181 <sect1>isalnum<label id="isalnum"><p>
3185 <tag/Function/Check if a given character is a letter or digit.
3186 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3187 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3188 <tag/Description/The function returns a non zero value if the given argument
3189 is a letter or digit. The return value is zero if the character is anything
3191 <tag/Notes/<itemize>
3192 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3193 inline sequence generated by the macro will not work correctly for values
3194 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3195 this range. The non inline function may be accessed by <tt/#undef/'ing
3197 <item>When compiling without <tt/-Os/, the function is only available as
3198 fastcall function, so it may only be used in presence of a prototype.
3200 <tag/Availability/ISO 9899
3202 <ref id="isalpha" name="isalpha">,
3203 <ref id="isascii" name="isascii">,
3204 <ref id="isblank" name="isblank">,
3205 <ref id="iscntrl" name="iscntrl">,
3206 <ref id="isdigit" name="isdigit">,
3207 <ref id="isgraph" name="isgraph">,
3208 <ref id="islower" name="islower">,
3209 <ref id="isprint" name="isprint">,
3210 <ref id="ispunct" name="ispunct">,
3211 <ref id="isspace" name="isspace">,
3212 <ref id="isupper" name="isupper">,
3213 <ref id="isxdigit" name="isxdigit">
3219 <sect1>isalpha<label id="isalpha"><p>
3223 <tag/Function/Check if a given character is a letter.
3224 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3225 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3226 <tag/Description/The function returns a non zero value if the given argument
3227 is a letter. The return value is zero if the character is anything else.
3228 <tag/Notes/<itemize>
3229 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3230 inline sequence generated by the macro will not work correctly for values
3231 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3232 this range. The non inline function may be accessed by <tt/#undef/'ing the
3234 <item>When compiling without <tt/-Os/, the function is only available as
3235 fastcall function, so it may only be used in presence of a prototype.
3237 <tag/Availability/ISO 9899
3239 <ref id="isalnum" name="isalnum">,
3240 <ref id="isascii" name="isascii">,
3241 <ref id="isblank" name="isblank">,
3242 <ref id="iscntrl" name="iscntrl">,
3243 <ref id="isdigit" name="isdigit">,
3244 <ref id="isgraph" name="isgraph">,
3245 <ref id="islower" name="islower">,
3246 <ref id="isprint" name="isprint">,
3247 <ref id="ispunct" name="ispunct">,
3248 <ref id="isspace" name="isspace">,
3249 <ref id="isupper" name="isupper">,
3250 <ref id="isxdigit" name="isxdigit">
3256 <sect1>isascii<label id="isascii"><p>
3260 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3261 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3262 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3263 <tag/Description/The function returns a non zero value if the given argument
3264 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3265 <tag/Notes/<itemize>
3266 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3267 inline sequence generated by the macro will not work correctly for values
3268 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3269 this range. The non inline function may be accessed by <tt/#undef/'ing the
3271 <item>When compiling without <tt/-Os/, the function is only available as
3272 fastcall function, so it may only be used in presence of a prototype.
3274 <tag/Availability/ISO 9899
3276 <ref id="isalnum" name="isalnum">,
3277 <ref id="isalpha" name="isalpha">,
3278 <ref id="isblank" name="isblank">,
3279 <ref id="iscntrl" name="iscntrl">,
3280 <ref id="isdigit" name="isdigit">,
3281 <ref id="isgraph" name="isgraph">,
3282 <ref id="islower" name="islower">,
3283 <ref id="isprint" name="isprint">,
3284 <ref id="ispunct" name="ispunct">,
3285 <ref id="isspace" name="isspace">,
3286 <ref id="isupper" name="isupper">,
3287 <ref id="isxdigit" name="isxdigit">
3293 <sect1>isblank<label id="isblank"><p>
3297 <tag/Function/Check if a given character is a space or tab.
3298 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3299 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3300 <tag/Description/The function returns a non zero value if the given argument
3301 is a space or tab character. The return value is zero if the character is
3303 <tag/Notes/<itemize>
3304 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3305 inline sequence generated by the macro will not work correctly for values
3306 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3307 this range. The non inline function may be accessed by <tt/#undef/'ing the
3309 <item>When compiling without <tt/-Os/, the function is only available as
3310 fastcall function, so it may only be used in presence of a prototype.
3312 <tag/Availability/cc65
3314 <ref id="isalnum" name="isalnum">,
3315 <ref id="isalpha" name="isalpha">,
3316 <ref id="isascii" name="isascii">,
3317 <ref id="iscntrl" name="iscntrl">,
3318 <ref id="isdigit" name="isdigit">,
3319 <ref id="isgraph" name="isgraph">,
3320 <ref id="islower" name="islower">,
3321 <ref id="isprint" name="isprint">,
3322 <ref id="ispunct" name="ispunct">,
3323 <ref id="isspace" name="isspace">,
3324 <ref id="isupper" name="isupper">,
3325 <ref id="isxdigit" name="isxdigit">
3331 <sect1>iscntrl<label id="iscntrl"><p>
3335 <tag/Function/Check if a given character is a control character.
3336 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3337 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3338 <tag/Description/The function returns a non zero value if the given argument
3339 is a control character. The return value is zero if the character is anything
3341 <tag/Notes/<itemize>
3342 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3343 inline sequence generated by the macro will not work correctly for values
3344 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3345 this range. The non inline function may be accessed by <tt/#undef/'ing the
3347 <item>When compiling without <tt/-Os/, the function is only available as
3348 fastcall function, so it may only be used in presence of a prototype.
3350 <tag/Availability/ISO 9899
3352 <ref id="isalnum" name="isalnum">,
3353 <ref id="isalpha" name="isalpha">,
3354 <ref id="isascii" name="isascii">,
3355 <ref id="isblank" name="isblank">,
3356 <ref id="isdigit" name="isdigit">,
3357 <ref id="isgraph" name="isgraph">,
3358 <ref id="islower" name="islower">,
3359 <ref id="isprint" name="isprint">,
3360 <ref id="ispunct" name="ispunct">,
3361 <ref id="isspace" name="isspace">,
3362 <ref id="isupper" name="isupper">,
3363 <ref id="isxdigit" name="isxdigit">
3369 <sect1>isdigit<label id="isdigit"><p>
3373 <tag/Function/Check if a given character is a digit.
3374 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3375 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
3376 <tag/Description/The function returns a non zero value if the given argument
3377 is a digit. The return value is zero if the character is anything else.
3378 <tag/Notes/<itemize>
3379 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3380 inline sequence generated by the macro will not work correctly for values
3381 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3382 this range. The non inline function may be accessed by <tt/#undef/'ing the
3384 <item>When compiling without <tt/-Os/, the function is only available as
3385 fastcall function, so it may only be used in presence of a prototype.
3387 <tag/Availability/ISO 9899
3389 <ref id="isalnum" name="isalnum">,
3390 <ref id="isalpha" name="isalpha">,
3391 <ref id="isascii" name="isascii">,
3392 <ref id="isblank" name="isblank">,
3393 <ref id="iscntrl" name="iscntrl">,
3394 <ref id="isgraph" name="isgraph">,
3395 <ref id="islower" name="islower">,
3396 <ref id="isprint" name="isprint">,
3397 <ref id="ispunct" name="ispunct">,
3398 <ref id="isspace" name="isspace">,
3399 <ref id="isupper" name="isupper">,
3400 <ref id="isxdigit" name="isxdigit">
3406 <sect1>isgraph<label id="isgraph"><p>
3410 <tag/Function/Check if a given character is a printable character (except
3412 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3413 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
3414 <tag/Description/The function returns a non zero value if the given argument
3415 is a printable character with the exception of space. The return value is zero
3416 if the character is anything else.
3417 <tag/Notes/<itemize>
3418 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3419 inline sequence generated by the macro will not work correctly for values
3420 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3421 this range. The non inline function may be accessed by <tt/#undef/'ing the
3423 <item>When compiling without <tt/-Os/, the function is only available as
3424 fastcall function, so it may only be used in presence of a prototype.
3426 <tag/Availability/ISO 9899
3428 <ref id="isalnum" name="isalnum">,
3429 <ref id="isalpha" name="isalpha">,
3430 <ref id="isascii" name="isascii">,
3431 <ref id="isblank" name="isblank">,
3432 <ref id="iscntrl" name="iscntrl">,
3433 <ref id="isdigit" name="isdigit">,
3434 <ref id="islower" name="islower">,
3435 <ref id="isprint" name="isprint">,
3436 <ref id="ispunct" name="ispunct">,
3437 <ref id="isspace" name="isspace">,
3438 <ref id="isupper" name="isupper">,
3439 <ref id="isxdigit" name="isxdigit">
3445 <sect1>islower<label id="islower"><p>
3449 <tag/Function/Check if a given character is a lower case letter.
3450 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3451 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
3452 <tag/Description/The function returns a non zero value if the given argument
3453 is a lower case letter. The return value is zero if the character is anything
3455 <tag/Notes/<itemize>
3456 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3457 inline sequence generated by the macro will not work correctly for values
3458 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3459 this range. The non inline function may be accessed by <tt/#undef/'ing the
3461 <item>When compiling without <tt/-Os/, the function is only available as
3462 fastcall function, so it may only be used in presence of a prototype.
3464 <tag/Availability/ISO 9899
3466 <ref id="isalnum" name="isalnum">,
3467 <ref id="isalpha" name="isalpha">,
3468 <ref id="isascii" name="isascii">,
3469 <ref id="isblank" name="isblank">,
3470 <ref id="iscntrl" name="iscntrl">,
3471 <ref id="isdigit" name="isdigit">,
3472 <ref id="isgraph" name="isgraph">,
3473 <ref id="isprint" name="isprint">,
3474 <ref id="ispunct" name="ispunct">,
3475 <ref id="isspace" name="isspace">,
3476 <ref id="isupper" name="isupper">,
3477 <ref id="isxdigit" name="isxdigit">
3483 <sect1>isprint<label id="isprint"><p>
3487 <tag/Function/Check if a given character is a printable character.
3488 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3489 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
3490 <tag/Description/The function returns a non zero value if the given argument
3491 is a printable character (this includes the space character). The return value
3492 is zero if the character is anything else.
3493 <tag/Notes/<itemize>
3494 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3495 inline sequence generated by the macro will not work correctly for values
3496 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3497 this range. The non inline function may be accessed by <tt/#undef/'ing the
3499 <item>When compiling without <tt/-Os/, the function is only available as
3500 fastcall function, so it may only be used in presence of a prototype.
3502 <tag/Availability/ISO 9899
3504 <ref id="isalnum" name="isalnum">,
3505 <ref id="isalpha" name="isalpha">,
3506 <ref id="isascii" name="isascii">,
3507 <ref id="isblank" name="isblank">,
3508 <ref id="iscntrl" name="iscntrl">,
3509 <ref id="isdigit" name="isdigit">,
3510 <ref id="isgraph" name="isgraph">,
3511 <ref id="islower" name="islower">,
3512 <ref id="ispunct" name="ispunct">,
3513 <ref id="isspace" name="isspace">,
3514 <ref id="isupper" name="isupper">,
3515 <ref id="isxdigit" name="isxdigit">
3521 <sect1>ispunct<label id="ispunct"><p>
3525 <tag/Function/Check if a given character is a printable character but not a
3526 space or an alphanumeric character.
3527 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3528 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
3529 <tag/Description/The function returns a non zero value if the given argument
3530 is a printable character, but not a space or anything alphanumeric. The return
3531 value is zero if the character is anything else.
3532 <tag/Notes/<itemize>
3533 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3534 inline sequence generated by the macro will not work correctly for values
3535 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3536 this range. The non inline function may be accessed by <tt/#undef/'ing the
3538 <item>When compiling without <tt/-Os/, the function is only available as
3539 fastcall function, so it may only be used in presence of a prototype.
3541 <tag/Availability/ISO 9899
3543 <ref id="isalnum" name="isalnum">,
3544 <ref id="isalpha" name="isalpha">,
3545 <ref id="isascii" name="isascii">,
3546 <ref id="isblank" name="isblank">,
3547 <ref id="iscntrl" name="iscntrl">,
3548 <ref id="isdigit" name="isdigit">,
3549 <ref id="isgraph" name="isgraph">,
3550 <ref id="islower" name="islower">,
3551 <ref id="isprint" name="isprint">,
3552 <ref id="isspace" name="isspace">,
3553 <ref id="isupper" name="isupper">,
3554 <ref id="isxdigit" name="isxdigit">
3560 <sect1>isspace<label id="isspace"><p>
3564 <tag/Function/Check if a given character is a a white-space character.
3565 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3566 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
3567 <tag/Description/The function returns a non zero value if the given argument
3568 is a white space character. The return value is zero if the character is
3569 anything else. The standard white space characters are: space, formfeed ('\f'),
3570 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
3572 <tag/Notes/<itemize>
3573 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3574 inline sequence generated by the macro will not work correctly for values
3575 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3576 this range. The non inline function may be accessed by <tt/#undef/'ing the
3578 <item>When compiling without <tt/-Os/, the function is only available as
3579 fastcall function, so it may only be used in presence of a prototype.
3581 <tag/Availability/ISO 9899
3583 <ref id="isalnum" name="isalnum">,
3584 <ref id="isalpha" name="isalpha">,
3585 <ref id="isascii" name="isascii">,
3586 <ref id="isblank" name="isblank">,
3587 <ref id="iscntrl" name="iscntrl">,
3588 <ref id="isdigit" name="isdigit">,
3589 <ref id="isgraph" name="isgraph">,
3590 <ref id="islower" name="islower">,
3591 <ref id="isprint" name="isprint">,
3592 <ref id="ispunct" name="ispunct">,
3593 <ref id="isupper" name="isupper">,
3594 <ref id="isxdigit" name="isxdigit">
3600 <sect1>isupper<label id="isupper"><p>
3604 <tag/Function/Check if a given character is an upper case letter.
3605 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3606 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
3607 <tag/Description/The function returns a non zero value if the given argument
3608 is an upper case letter. The return value is zero if the character is anything
3610 <tag/Notes/<itemize>
3611 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3612 inline sequence generated by the macro will not work correctly for values
3613 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3614 this range. The non inline function may be accessed by <tt/#undef/'ing the
3616 <item>When compiling without <tt/-Os/, the function is only available as
3617 fastcall function, so it may only be used in presence of a prototype.
3619 <tag/Availability/ISO 9899
3621 <ref id="isalnum" name="isalnum">,
3622 <ref id="isalpha" name="isalpha">,
3623 <ref id="isascii" name="isascii">,
3624 <ref id="isblank" name="isblank">,
3625 <ref id="iscntrl" name="iscntrl">,
3626 <ref id="isdigit" name="isdigit">,
3627 <ref id="isgraph" name="isgraph">,
3628 <ref id="islower" name="islower">,
3629 <ref id="isprint" name="isprint">,
3630 <ref id="ispunct" name="ispunct">,
3631 <ref id="isspace" name="isspace">,
3632 <ref id="isxdigit" name="isxdigit">
3638 <sect1>isxdigit<label id="isxdigit"><p>
3642 <tag/Function/Check if a given character is a hexadecimal digit.
3643 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3644 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
3645 <tag/Description/The function returns a non zero value if the given argument
3646 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
3647 character is anything else.
3648 <tag/Notes/<itemize>
3649 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3650 inline sequence generated by the macro will not work correctly for values
3651 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3652 this range. The non inline function may be accessed by <tt/#undef/'ing the
3654 <item>When compiling without <tt/-Os/, the function is only available as
3655 fastcall function, so it may only be used in presence of a prototype.
3657 <tag/Availability/ISO 9899
3659 <ref id="isalnum" name="isalnum">,
3660 <ref id="isalpha" name="isalpha">,
3661 <ref id="isascii" name="isascii">,
3662 <ref id="isblank" name="isblank">,
3663 <ref id="iscntrl" name="iscntrl">,
3664 <ref id="isdigit" name="isdigit">,
3665 <ref id="isgraph" name="isgraph">,
3666 <ref id="islower" name="islower">,
3667 <ref id="isprint" name="isprint">,
3668 <ref id="ispunct" name="ispunct">,
3669 <ref id="isspace" name="isspace">,
3670 <ref id="isupper" name="isupper">
3676 <sect1>itoa<label id="itoa"><p>
3680 <tag/Function/Convert an integer into a string.
3681 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3682 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
3683 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
3684 <tt/radix/ as the base.
3685 <tag/Notes/<itemize>
3686 <item>There are no provisions to prevent a buffer overflow.
3687 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
3688 <item>The function is non standard, so it is not available in strict ANSI mode.
3689 You should probably use <tt/sprintf/ instead.
3690 <item>The function is only available as fastcall function, so it may only be
3691 used in presence of a prototype.
3693 <tag/Availability/cc65
3695 <ref id="atoi" name="atoi">,
3696 <ref id="atol" name="atol">,
3697 <ref id="ltoa" name="ltoa">,
3698 <ref id="ultoa" name="ultoa">,
3699 <ref id="utoa" name="utoa">
3705 <sect1>joy_count<label id="joy_count"><p>
3709 <tag/Function/Return the number of joysticks supported by the current driver.
3710 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3711 <tag/Declaration/<tt/unsigned char joy_count (void);/
3712 <tag/Description/The function returns a the number of joysticks supported
3713 by the current joystick driver.
3714 <tag/Notes/<itemize>
3715 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3716 name="joy_load_driver"> before calling this function.
3717 <item>The function returns the number of joysticks supported by the driver.
3718 There's no way to check for the number of actually connected joysticks.
3720 <tag/Availability/cc65
3722 <ref id="joy_load_driver" name="joy_load_driver">,
3723 <ref id="joy_read" name="joy_read">
3729 <sect1>joy_install<label id="joy_install"><p>
3733 <tag/Function/Install an already loaded driver and return an error code.
3734 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3735 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
3736 <tag/Description/The function installs a driver that was already loaded into
3737 memory (or linked statically to the program). It returns an error code
3738 (<tt/JOY_ERR_OK/ in case of success).
3739 <tag/Notes/<itemize>
3740 <item>The function is only available as fastcall function, so it may only be
3741 used in presence of a prototype.
3743 <tag/Availability/cc65
3745 <ref id="joy_load_driver" name="joy_load_driver">,
3746 <ref id="joy_uninstall" name="joy_uninstall">,
3747 <ref id="joy_unload" name="joy_unload">
3753 <sect1>joy_load_driver<label id="joy_load_driver"><p>
3757 <tag/Function/Load a driver from disk and install it.
3758 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3759 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
3760 <tag/Description/The function loads a driver with the given name from disk
3761 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
3762 driver was successfully loaded and installed.
3763 <tag/Notes/<itemize>
3764 <item>The function is only available as fastcall function, so it may only be
3765 used in presence of a prototype.
3767 <tag/Availability/cc65
3769 <ref id="joy_install" name="joy_install">,
3770 <ref id="joy_uninstall" name="joy_uninstall">,
3771 <ref id="joy_unload" name="joy_unload">
3777 <sect1>joy_read<label id="joy_read"><p>
3781 <tag/Function/Read the status of a joystick.
3782 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3783 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
3784 <tag/Description/The function reads the status bits for a joystick. The number
3785 of the joystick is passed as parameter. The result may be examined by using one
3786 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
3787 <tag/Notes/<itemize>
3788 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3789 name="joy_load_driver"> before calling this function.
3790 <item>The function is only available as fastcall function, so it may only be
3791 used in presence of a prototype.
3793 <tag/Availability/cc65
3795 <ref id="joy_count" name="joy_count">,
3796 <ref id="joy_load_driver" name="joy_load_driver">,
3797 <ref id="joy_unload" name="joy_unload">
3803 <sect1>joy_uninstall<label id="joy_uninstall"><p>
3807 <tag/Function/Uninstall the current joystick driver.
3808 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3809 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
3810 <tag/Description/The function uninstalls the currently installed joystick
3811 driver. It does not remove the driver from memory. The function returns an
3812 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
3813 <tag/Notes/<itemize>
3814 <item>A joystick driver must be installed using <ref id="joy_install"
3815 name="joy_install"> before calling this function.
3817 <tag/Availability/cc65
3819 <ref id="joy_install" name="joy_install">,
3820 <ref id="joy_load_driver" name="joy_load_driver">,
3821 <ref id="joy_unload" name="joy_unload">
3827 <sect1>joy_unload<label id="joy_unload"><p>
3831 <tag/Function/Uninstall, then unload the current joystick driver.
3832 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3833 <tag/Declaration/<tt/unsigned char joy_unload (void);/
3834 <tag/Description/The function uninstalls the currently installed joystick
3835 driver and removes it from memory. An error code is returned, which is
3836 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
3837 <tag/Notes/<itemize>
3838 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3839 name="joy_load_driver"> before calling this function.
3841 <tag/Availability/cc65
3843 <ref id="joy_load_driver" name="joy_load_driver">
3849 <sect1>kbhit<label id="kbhit"><p>
3853 <tag/Function/Check if there's a key waiting in the keyboard buffer.
3854 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3855 <tag/Declaration/<tt/unsigned char kbhit (void);/
3856 <tag/Description/The function returns a value of zero if there is no character
3857 waiting to be read from the keyboard. It returns non zero otherwise.
3858 <tag/Notes/<itemize>
3859 <item>If the system does not support a keyboard buffer (most systems
3860 do), the function is rather useless.
3862 <tag/Availability/cc65
3864 <ref id="cgetc" name="cgetc">,
3865 <ref id="cursor" name="cursor">
3871 <sect1>labs<label id="labs"><p>
3875 <tag/Function/Returns the absolute value of a long integer.
3876 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3877 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
3878 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
3880 <tag/Notes/<itemize>
3881 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
3882 <item>The function is only available as fastcall function, so it may only be
3883 used in presence of a prototype.
3885 <tag/Availability/ISO 9899
3887 <ref id="abs" name="abs">
3893 <sect1>ltoa<label id="ltoa"><p>
3897 <tag/Function/Convert a long integer into a string.
3898 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3899 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
3900 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
3901 using <tt/radix/ as the base.
3902 <tag/Notes/<itemize>
3903 <item>There are no provisions to prevent a buffer overflow.
3904 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
3905 <item>The function is non standard, so it is not available in strict ANSI mode.
3906 You should probably use <tt/sprintf/ instead.
3907 <item>The function is only available as fastcall function, so it may only be
3908 used in presence of a prototype.
3910 <tag/Availability/cc65
3912 <ref id="atoi" name="atoi">,
3913 <ref id="atol" name="atol">,
3914 <ref id="itoa" name="itoa">,
3915 <ref id="ultoa" name="ultoa">,
3916 <ref id="utoa" name="utoa">
3922 <sect1>localeconv<label id="localeconv"><p>
3926 <tag/Function/Returns a pointer to the current locale structure.
3927 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3928 <tag/Declaration/<tt/struct lconv* localeconv (void);/
3929 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
3931 <tag/Notes/<itemize>
3932 <item>cc65 supports only the "C" locale, so even after setting a new locale
3933 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
3936 <tag/Availability/ISO 9899
3938 <ref id="setlocale" name="setlocale">
3944 <sect1>longjmp<label id="longjmp"><p>
3948 <tag/Function/Non local goto.
3949 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
3950 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
3951 <tag/Description/The <tt/longjmp/ function restores a program context from the
3952 data in <tt/buf/, which must have been set by a preceeding call to
3953 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
3954 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
3956 <tag/Notes/<itemize>
3957 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
3958 was called with a value of one.
3959 <item>The function is only available as fastcall function, so it may only
3960 be used in presence of a prototype.
3962 <tag/Availability/ISO 9899
3964 <ref id="setjmp" name="setjmp">
3970 <sect1>malloc<label id="malloc"><p>
3974 <tag/Function/Allocate dynamic memory.
3975 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3976 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
3977 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
3978 pointer to the allocated memory block. On error (not enough memory available),
3979 <tt/malloc/ returns <tt/NULL/.
3980 <tag/Notes/<itemize>
3981 <item>The function is only available as fastcall function, so it may only
3982 be used in presence of a prototype.
3984 <tag/Availability/ISO 9899
3986 <ref id="_heapadd" name="_heapadd">,
3987 <ref id="_heapblocksize" name="_heapblocksize">,
3988 <ref id="_heapmaxavail" name="_heapmaxavail">,
3989 <ref id="_heapmemavail" name="_heapmemavail">,
3990 <ref id="calloc" name="calloc">,
3991 <ref id="free" name="free">,
3992 <ref id="realloc" name="realloc">,
3993 <ref id="strdup" name="strdup">
3999 <sect1>memchr<label id="memchr"><p>
4003 <tag/Function/Search for a character in a block of raw memory.
4004 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4005 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4006 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4007 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4008 that is of size <tt/count/. Upon completion, the function returns a pointer to
4009 the character found, or a null pointer if the character was not found.
4010 <tag/Notes/<itemize>
4011 <item>The function is only available as fastcall function, so it may only
4012 be used in presence of a prototype.
4014 <tag/Availability/ISO 9899
4016 <ref id="strchr" name="strchr">
4022 <sect1>memcmp<label id="memcmp"><p>
4026 <tag/Function/Compare two memory areas.
4027 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4028 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4029 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4030 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4031 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4032 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4033 <tag/Notes/<itemize>
4034 <item>The function is only available as fastcall function, so it may only
4035 be used in presence of a prototype.
4037 <tag/Availability/ISO 9899
4039 <ref id="strcmp" name="strcmp">,
4040 <ref id="memmove" name="memmove">,
4041 <ref id="memset" name="memset">
4047 <sect1>memcpy<label id="memcpy"><p>
4051 <tag/Function/Copy a memory area.
4052 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4053 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4054 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4055 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4057 <tag/Notes/<itemize>
4058 <item>The result is undefined if the memory areas do overlap. Use
4059 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4060 <item>The function is only available as fastcall function, so it may only
4061 be used in presence of a prototype.
4063 <tag/Availability/ISO 9899
4065 <ref id="_swap" name="_swap">,
4066 <ref id="memmove" name="memmove">,
4067 <ref id="memset" name="memset">
4073 <sect1>memmove<label id="memmove"><p>
4077 <tag/Function/Copy a memory area.
4078 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4079 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4080 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4081 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4083 <tag/Notes/<itemize>
4084 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4085 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4086 <item>The function is only available as fastcall function, so it may only
4087 be used in presence of a prototype.
4089 <tag/Availability/ISO 9899
4091 <ref id="_swap" name="_swap">,
4092 <ref id="memcpy" name="memcpy">,
4093 <ref id="memset" name="memset">
4099 <sect1>memset<label id="memset"><p>
4103 <tag/Function/Fill a memory area.
4104 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4105 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4106 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4107 the value <tt/val/. The function returns <tt/p/.
4108 <tag/Notes/<itemize>
4109 <item>The function is only available as fastcall function, so it may only
4110 be used in presence of a prototype.
4112 <tag/Availability/ISO 9899
4114 <ref id="_swap" name="_swap">,
4115 <ref id="bzero" name="bzero">,
4116 <ref id="memcpy" name="memcpy">,
4117 <ref id="memmove" name="memmove">
4123 <sect1>mod_free<label id="mod_free"><p>
4127 <tag/Function/Free a relocatable module.
4128 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4129 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4130 <tag/Description/The function will free a module loaded into memory by use of
4131 the <tt/<ref id="mod_load" name="mod_load">/ function.
4132 <tag/Notes/<itemize>
4133 <item>The pointer passed as parameter is the pointer to the module memory,
4134 not the pointer to the control structure.
4136 <tag/Availability/cc65
4138 <ref id="mod_load" name="mod_load">
4144 <sect1>mod_load<label id="mod_load"><p>
4148 <tag/Function/Load a relocatable module.
4149 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4150 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
4151 <tag/Description/The function will load a code module into memory and relocate
4152 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4153 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4154 the module just loaded. Possible error codes are:
4156 <item><tt/MLOAD_OK/ - Module load successful
4157 <item><tt/MLOAD_ERR_READ/ - Read error
4158 <item><tt/MLOAD_ERR_HDR/ - Header error
4159 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4160 <item><tt/MLOAD_ERR_FMT/ - Data format error
4161 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4163 <tag/Notes/<itemize>
4164 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4165 relocatable o65 modules for use with this function.
4167 <tag/Availability/cc65
4169 <ref id="mod_free" name="mod_free">
4175 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4179 <tag/Function/Specify a bounding box for the mouse cursor.
4180 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4181 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4182 <tag/Description/The function allows to set a bounding box for mouse movement.
4183 <tag/Notes/<itemize>
4184 <item>The function does not check if the mouse cursor is currently within the
4185 given rectangle. Placing the mouse cursor within the bounding box is the
4186 responsibility of the programmer.
4187 <item>While the bounding box may be larger than the actual screen size, the
4188 standard mouse cursor draw routines may fail to set the cursor to coordinates
4189 outside of the screen area. Depending on the platform, you may have to supply
4190 your own mouse cursor routines.
4191 <item>The function is only available as fastcall function, so it may only be
4192 used in presence of a prototype.
4194 <tag/Availability/cc65
4196 <ref id="mouse_getbox" name="mouse_getbox">,
4197 <ref id="mouse_move" name="mouse_move">
4203 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4207 <tag/Function/Return the current bounding box for the mouse cursor.
4208 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4209 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4210 <tag/Description/The function queries the current bounding box for mouse
4212 <tag/Notes/<itemize>
4213 <item>The function is only available as fastcall function, so it may only be
4214 used in presence of a prototype.
4216 <tag/Availability/cc65
4218 <ref id="mouse_move" name="mouse_move">,
4219 <ref id="mouse_setbox" name="mouse_setbox">
4225 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4229 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4230 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4231 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4232 <tag/Description/The function returns a bit mask that encodes the state of the
4233 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4235 <tag/Availability/cc65
4237 <ref id="mouse_info" name="mouse_info">,
4238 <ref id="mouse_pos" name="mouse_pos">
4244 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4248 <tag/Function/Return a readable error message for an error code.
4249 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4250 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4252 <tag/Description/The function returns an error message (in english) for the
4253 error code passed parameter.
4254 <tag/Notes/<itemize>
4255 <item>The function will return "Unknown error" for invalid error codes.
4256 <item>The function is only available as fastcall function, so it may only be
4257 used in presence of a prototype.
4259 <tag/Availability/cc65
4261 <ref id="mouse_load_driver" name="mouse_load_driver">,
4262 <ref id="mouse_uninstall" name="mouse_uninstall">,
4263 <ref id="mouse_unload" name="mouse_unload">
4269 <sect1>mouse_hide<label id="mouse_hide"><p>
4273 <tag/Function/Hide the mouse pointer.
4274 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4275 <tag/Declaration/<tt/void mouse_hide (void);/
4276 <tag/Description/The function hides the mouse pointer. It manages a counter
4277 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4278 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4279 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4281 <tag/Availability/cc65
4283 <ref id="mouse_show" name="mouse_show">
4289 <sect1>mouse_info<label id="mouse_info"><p>
4293 <tag/Function/Return the state of the mouse buttons and the position of the
4295 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4296 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
4297 <tag/Description/The function returns the state of the mouse buttons and the
4298 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
4299 <tag/Notes/<itemize>
4300 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
4301 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
4302 name="mouse_pos">/ instead.
4303 <item>The function is only available as fastcall function, so it may only be
4304 used in presence of a prototype.
4306 <tag/Availability/cc65
4308 <ref id="mouse_buttons" name="mouse_buttons">,
4309 <ref id="mouse_pos" name="mouse_pos">
4315 <sect1>mouse_install<label id="mouse_install"><p>
4319 <tag/Function/Install an already loaded mouse driver.
4320 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4321 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
4322 mouse_callbacks* c, void* driver);/
4323 <tag/Description/The function installs an already loaded mouse driver and
4324 returns an error code. The <tt/mouse_callbacks/ structure passed as first
4325 parameter contains pointers to routines needed to move or hide/show the mouse
4326 pointer. Defaults for these routines are supplied by the library, so if you
4327 can live with these defaults (which are platform specific), just pass a
4328 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
4329 driver linked statically to the program.
4330 <tag/Notes/<itemize>
4331 <item>Not all drivers are able to detect if the supported hardware is really
4333 <item>After installing a driver, the mouse cursor is hidden.
4334 <item>The function is only available as fastcall function, so it may only be
4335 used in presence of a prototype.
4337 <tag/Availability/cc65
4339 <ref id="mouse_load_driver" name="mouse_load_driver">,
4340 <ref id="mouse_uninstall" name="mouse_uninstall">,
4341 <ref id="mouse_unload" name="mouse_unload">
4347 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
4351 <tag/Function/Call the driver specific ioctl function.
4352 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4353 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
4354 <tag/Description/The function calls the IOCTL entry in the mouse driver,
4355 which is driver specific. The <tt/code/ parameter will choose between
4356 different IOCTL functions, and the <tt/data/ depends on code. The
4357 function returns an error code. The purpose of this function is to allow
4358 for driver specific extensions. See the documentation for a specific mouse
4359 driver for supported ioctl calls.
4360 <tag/Notes/<itemize>
4361 <item>Calling this function is non portable, because each driver may
4362 implement different ioctl calls (or none at all).
4363 <item>The function is only available as fastcall function, so it may only be
4364 used in presence of a prototype.
4366 <tag/Availability/cc65
4372 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
4376 <tag/Function/Load and initialize a mouse driver.
4377 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4378 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
4379 mouse_callbacks* c, const char* driver);/
4380 <tag/Description/Load a mouse driver into memory and initialize it. The
4381 function returns an error code that tells if the call has been successful. The
4382 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
4383 routines needed to move or hide/show the mouse pointer. Defaults for these
4384 routines are supplied by the library, so if you can live with these defaults
4385 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
4386 <tag/Notes/<itemize>
4387 <item>The driver is loaded by name, so currently you must know the type of
4388 mouse that should be supported. There is no autodetect capability.
4389 <item>Not all drivers are able to detect if the supported hardware is really
4391 <item>After installing a driver, the mouse cursor is hidden.
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_install" name="mouse_install">,
4398 <ref id="mouse_uninstall" name="mouse_uninstall">,
4399 <ref id="mouse_unload" name="mouse_unload">
4405 <sect1>mouse_move<label id="mouse_move"><p>
4409 <tag/Function/Move the mouse cursor to a specific position.
4410 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4411 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
4412 <tag/Description/The function updates the mouse position. If the mouse cursor
4413 is visible, it is shown at the new position.
4414 <tag/Notes/<itemize>
4415 <item>The function does not check if the new position is within the bounding
4416 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
4417 <item>The function is only available as fastcall function, so it may only be
4418 used in presence of a prototype.
4420 <tag/Availability/cc65
4422 <ref id="mouse_getbox" name="mouse_getbox">,
4423 <ref id="mouse_setbox" name="mouse_setbox">
4429 <sect1>mouse_pos<label id="mouse_pos"><p>
4433 <tag/Function/Return the position of the mouse.
4434 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4435 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
4436 <tag/Description/The function returns the position of the mouse in the
4437 <tt/mouse_pos/ structure passed as parameter.
4438 <tag/Notes/<itemize>
4439 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
4440 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
4441 name="mouse_info">/ instead.
4442 <item>The function is only available as fastcall function, so it may only be
4443 used in presence of a prototype.
4445 <tag/Availability/cc65
4447 <ref id="mouse_buttons" name="mouse_buttons">,
4448 <ref id="mouse_info" name="mouse_info">
4454 <sect1>mouse_show<label id="mouse_show"><p>
4458 <tag/Function/Show the mouse pointer.
4459 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4460 <tag/Declaration/<tt/void mouse_show (void);/
4461 <tag/Description/The function shows the mouse pointer. It manages a counter
4462 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
4463 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
4464 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
4465 <tag/Availability/cc65
4467 <ref id="mouse_hide" name="mouse_hide">
4473 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
4477 <tag/Function/Uninstall an already loaded mouse driver.
4478 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4479 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
4480 <tag/Description/The function uninstalls an already loaded mouse driver but
4481 don't removes it from memory.
4482 <tag/Notes/<itemize>
4483 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
4484 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
4485 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
4488 <tag/Availability/cc65
4490 <ref id="mouse_install" name="mouse_install">,
4491 <ref id="mouse_load_driver" name="mouse_load_driver">,
4492 <ref id="mouse_unload" name="mouse_unload">
4498 <sect1>mouse_unload<label id="mouse_unload"><p>
4502 <tag/Function/Unload a mouse driver.
4503 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4504 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
4505 <tag/Description/The function unloads a loaded mouse driver and frees all
4506 memory allocated for the driver.
4507 <tag/Notes/<itemize>
4508 <item>The function does nothing if no driver is loaded.
4510 <tag/Availability/cc65
4512 <ref id="mouse_install" name="mouse_install">,
4513 <ref id="mouse_load_driver" name="mouse_load_driver">,
4514 <ref id="mouse_uninstall" name="mouse_uninstall">
4520 <sect1>offsetof<label id="offsetof"><p>
4524 <tag/Function/Calculate the offset of a struct or union member.
4525 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
4526 <tag/Declaration/<tt/size_t offsetof (type, member);/
4527 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
4528 or <tt/union/ member.
4529 <tag/Notes/<itemize>
4530 <item>The function is actually a macro.
4532 <tag/Availability/ISO 9899
4538 <sect1>open<label id="open"><p>
4542 <tag/Function/Open and possibly create a file.
4543 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
4544 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
4545 <tag/Description/<tt/open/ opens a file and returns the file descriptor
4546 associated with it. On error, -1 is returned and an error code is stored in
4547 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
4548 <tag/Notes/<itemize>
4549 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
4550 open, which is used as the permission mask when a new file is created. While
4551 cc65 allows to pass this argument, it is ignored.
4553 <tag/Availability/POSIX 1003.1
4555 <ref id="close" name="close">,
4556 <ref id="creat" name="creat">
4562 <sect1>opendir<label id="opendir"><p>
4566 <tag/Function/Open a directory.
4567 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
4568 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
4569 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
4570 descriptor associated with it. On error, NULL is returned and an error code is
4571 stored in <tt/errno/.
4572 <tag/Notes/<itemize>
4573 <item>The function is only available as fastcall function, so it may only
4574 be used in presence of a prototype.
4576 <tag/Availability/POSIX 1003.1
4578 <ref id="closedir" name="closedir">,
4579 <ref id="readdir" name="readdir">
4585 <sect1>peekbsys<label id="peekbsys"><p>
4589 <tag/Function/Read one byte from a location in the system bank.
4590 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4591 <tt/<ref id="cbm510.h" name="cbm510.h">/
4592 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
4593 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
4594 system bank (bank 15) of the CBM PET-II machines and returns it.
4595 <tag/Notes/<itemize>
4596 <item>The function is only available as fastcall function, so it may only
4597 be used in presence of a prototype.
4598 <item>This function may be a macro depending on the compiler options. The
4599 actual function is accessible by #undef'ing the macro.
4601 <tag/Availability/cc65
4603 <ref id="PEEK" name="PEEK">,
4604 <ref id="PEEKW" name="PEEKW">,
4605 <ref id="peekwsys" name="peekwsys">,
4606 <ref id="pokebsys" name="pokebsys">,
4607 <ref id="pokewsys" name="pokewsys">
4613 <sect1>peekwsys<label id="peekwsys"><p>
4617 <tag/Function/Read one word from a location in the system bank.
4618 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4619 <tt/<ref id="cbm510.h" name="cbm510.h">/
4620 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
4621 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
4622 system bank (bank 15) of the CBM PET-II machines and returns it. Following
4623 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
4624 high byte is read from <tt/addr+1/.
4625 <tag/Notes/<itemize>
4626 <item>The function is only available as fastcall function, so it may only
4627 be used in presence of a prototype.
4628 <item>The order in which the two bytes are read is undefined.
4630 <tag/Availability/cc65
4632 <ref id="PEEK" name="PEEK">,
4633 <ref id="PEEKW" name="PEEKW">,
4634 <ref id="peekbsys" name="peekbsys">,
4635 <ref id="pokebsys" name="pokebsys">,
4636 <ref id="pokewsys" name="pokewsys">
4642 <sect1>perror<label id="perror"><p>
4646 <tag/Function/Print an error message for the error in <tt/errno/.
4647 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4648 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
4649 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
4650 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
4651 a blank. Then the error message for the current contents of <tt/errno/ is
4652 printed followed by a newline. The message output is the same as returned by
4653 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
4654 <tag/Notes/<itemize>
4655 <item>The function is only available as fastcall function, so it may only
4656 be used in presence of a prototype.
4658 <tag/Availability/ISO 9899
4660 <ref id="_poserror" name="_poserror">,
4661 <ref id="strerror" name="strerror">
4667 <sect1>pokebsys<label id="pokebsys"><p>
4671 <tag/Function/Write one byte to a location in the system bank.
4672 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4673 <tt/<ref id="cbm510.h" name="cbm510.h">/
4674 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
4675 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
4676 system bank (bank 15) of the CBM PET-II machines.
4677 <tag/Notes/<itemize>
4678 <item>The function is only available as fastcall function, so it may only
4679 be used in presence of a prototype.
4681 <tag/Availability/cc65
4683 <ref id="POKE" name="POKE">,
4684 <ref id="POKEW" name="POKEW">,
4685 <ref id="peekbsys" name="peekbsys">,
4686 <ref id="peekwsys" name="peekwsys">,
4687 <ref id="pokewsys" name="pokewsys">
4693 <sect1>pokewsys<label id="pokewsys"><p>
4697 <tag/Function/Write one word to a location in the system bank.
4698 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4699 <tt/<ref id="cbm510.h" name="cbm510.h">/
4700 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
4701 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
4702 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
4703 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
4704 high byte is written to <tt/addr+1/.
4705 <tag/Notes/<itemize>
4706 <item>The function is only available as fastcall function, so it may only
4707 be used in presence of a prototype.
4708 <item>The order in which the two bytes are written is undefined.
4710 <tag/Availability/cc65
4712 <ref id="POKE" name="POKE">,
4713 <ref id="POKEW" name="POKEW">,
4714 <ref id="peekbsys" name="peekbsys">,
4715 <ref id="peekwsys" name="peekwsys">,
4716 <ref id="pokebsys" name="pokebsys">
4722 <sect1>qsort<label id="qsort"><p>
4726 <tag/Function/Sort an array.
4727 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4728 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
4729 size_t size, int (*compare) (const void*, const void*));/
4730 <tag/Description/<tt/qsort/ sorts an array according to a given compare
4731 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
4732 is the number of elements, <tt/size/ the size of an element and <tt/compare/
4733 the function used to compare the members.
4734 <tag/Notes/<itemize>
4735 <item>If there are multiple members with the same key, the order after calling
4736 the function is undefined.
4737 <item>The function is only available as fastcall function, so it may only
4738 be used in presence of a prototype.
4740 <tag/Availability/ISO 9899
4742 <ref id="bsearch" name="bsearch">
4748 <sect1>raise<label id="raise"><p>
4752 <tag/Function/Send a signal to the executing program.
4753 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4754 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
4755 <tag/Description/<tt/raise/ sends the given signal to the program. If the
4756 program has installed a signal handler for the signal, this signal handler
4757 will be executed. If no handler has been installed, the default action for
4758 the raised signal will be taken. The function returns zero on success,
4760 <tag/Notes/<itemize>
4761 <item>The function is only available as fastcall function, so it may only
4762 be used in presence of a prototype.
4764 <tag/Availability/ISO 9899
4766 <ref id="abort" name="abort">,
4767 <ref id="signal" name="signal">
4773 <sect1>rand<label id="rand"><p>
4777 <tag/Function/Return a pseudo random number.
4778 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4779 <tag/Declaration/<tt/int rand (void);/
4780 <tag/Description/The function returns a pseudo random number
4781 between 0 and <tt/RAND_MAX/ (exclusive).
4782 <tag/Notes/<itemize>
4783 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
4784 flow of numbers is generated.
4785 <item>On startup, the function behaves as if <ref id="srand" name="srand">
4786 had been used with an argument of 1.
4788 <tag/Availability/ISO 9899
4790 <ref id="_randomize" name="_randomize">,
4791 <ref id="srand" name="srand">
4797 <sect1>readdir<label id="readdir"><p>
4801 <tag/Function/Read a directory.
4802 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
4803 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
4804 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
4805 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
4806 and returns a pointer to it. If the end of directory is reached, or an error
4807 occurs, NULL is returned. In case of errors, an error code is stored into
4809 <tag/Notes/<itemize>
4810 <item>The function is only available as fastcall function, so it may only
4811 be used in presence of a prototype.
4812 <item>The returned pointer may point to a statically allocated instance of
4813 <tt/struct dirent/, so it may get overwritten by subsequent calls to
4815 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
4816 confused when opening/closing files between directory reads. So for example a
4817 program that reads the list of files on a disk, and after each call to
4818 <tt/readdir/, opens the file to process it, will fail.<newline>
4819 Possible solutions are reading the directory into memory before processing the
4820 file list, or to reset the directory by seeking to the correct position after
4821 opening/closing a file:
4823 seekdir (DIR, telldir (DIR));
4825 Platforms known to work without problems are: Apple.
4827 <tag/Availability/POSIX 1003.1
4829 <ref id="closedir" name="closedir">,
4830 <ref id="opendir" name="opendir">
4836 <sect1>realloc<label id="realloc"><p>
4840 <tag/Function/Change the size of an allocated memory block.
4841 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4842 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
4843 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
4844 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
4845 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
4846 behaves as if <tt/free/ had been called. On error (not enough memory
4847 available), <tt/realloc/ returns <tt/NULL/.
4848 <tag/Notes/<itemize>
4849 <item>The part of the memory block that is returned will have its contents
4851 <item>This function is somewhat dangerous to use. Be careful to save the
4852 pointer you're passing somewhere else, otherwise
4854 ptr = realloc (ptr, size);
4856 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
4857 <item>The function is only available as fastcall function, so it may only
4858 be used in presence of a prototype.
4860 <tag/Availability/ISO 9899
4862 <ref id="_heapadd" name="_heapadd">,
4863 <ref id="_heapblocksize" name="_heapblocksize">,
4864 <ref id="_heapmaxavail" name="_heapmaxavail">,
4865 <ref id="_heapmemavail" name="_heapmemavail">,
4866 <ref id="calloc" name="calloc">,
4867 <ref id="free" name="free">,
4868 <ref id="realloc" name="realloc">
4874 <sect1>remove<label id="remove"><p>
4878 <tag/Function/Delete a file.
4879 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4880 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
4881 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
4882 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4883 code describing the reason for the failure.
4884 <tag/Notes/<itemize>
4885 <item>This function is not available on all cc65 targets (depends on the
4886 availability of file I/O).
4887 <item>The function is only available as fastcall function, so it may only
4888 be used in presence of a prototype.
4890 <tag/Availability/ISO 9899
4892 <ref id="rename" name="rename">,
4893 <ref id="unlink" name="unlink">
4896 #include <stdio.h>
4898 #define FILENAME "helloworld"
4900 if (remove (FILENAME) == 0) {
4901 printf ("We deleted %s successfully\n", FILENAME);
4903 printf ("There was a problem deleting %s\n", FILENAME);
4910 <sect1>rename<label id="rename"><p>
4914 <tag/Function/Rename a file.
4915 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4916 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
4917 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
4918 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4919 code describing the reason for the failure.
4920 <tag/Notes/<itemize>
4921 <item>This function is not available on all cc65 targets (depends on the
4922 capabilities of the storage devices).
4923 <item>The function is only available as fastcall function, so it may only
4924 be used in presence of a prototype.
4926 <tag/Availability/ISO 9899
4928 <ref id="remove" name="remove">
4931 #include <stdio.h>
4933 #define OLDNAME "textfile.txt"
4934 #define NEWNAME "textfile.bak"
4936 if (rename (OLDNAME, NEWNAME) == 0) {
4937 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
4939 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
4946 <sect1>reset_brk<label id="reset_brk"><p>
4950 <tag/Function/Resets the break vector to its original value.
4951 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4952 <tag/Declaration/<tt/void reset_brk (void);/
4953 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
4954 before a call to <tt/set_brk/.
4955 <tag/Notes/<itemize>
4956 <item>The break vector is reset on program termination, so it's not strictly
4957 necessary to call this function as a part of your clean-up when exitting the program.
4959 <tag/Availability/cc65
4961 <ref id="reset_irq" name="reset_irq">,
4962 <ref id="set_brk" name="set_brk">,
4963 <ref id="set_irq" name="set_irq">
4969 <sect1>reset_irq<label id="reset_irq"><p>
4973 <tag/Function/Resets the C level interrupt request vector.
4974 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4975 <tag/Declaration/<tt/void reset_irq (void);/
4976 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
4977 <tag/Notes/<itemize>
4978 <item>The interrupt vector is reset on program termination, so it's not strictly
4979 necessary to call this function as a part of your clean-up when exitting the program.
4981 <tag/Availability/cc65
4983 <ref id="reset_brk" name="reset_brk">,
4984 <ref id="set_brk" name="set_brk">,
4985 <ref id="set_irq" name="set_irq">
4991 <sect1>revers<label id="revers"><p>
4995 <tag/Function/Control revers character display.
4996 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4997 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
4998 <tag/Description/If the argument is non zero, the function enables reverse
4999 character display. If the argument is zero, reverse character display is
5000 switched off. The old value of the setting is returned.
5001 <tag/Notes/<itemize>
5002 <item>The function may not be supported by the hardware, in which case
5003 the call is ignored.
5004 <item>The function is only available as fastcall function, so it may only
5005 be used in presence of a prototype.
5007 <tag/Availability/cc65
5009 <ref id="textcolor" name="textcolor">
5015 <sect1>rewinddir<label id="rewinddir"><p>
5019 <tag/Function/Reset a directory stream.
5020 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5021 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5022 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5023 pointed to by <tt/dir/ to the start of the directory.
5024 <tag/Notes/<itemize>
5025 <item>The function is only available as fastcall function, so it may only
5026 be used in presence of a prototype.
5028 <tag/Availability/POSIX 1003.1
5030 <ref id="seekdir" name="seekdir">,
5031 <ref id="telldir" name="telldir">
5037 <sect1>screensize<label id="screensize"><p>
5041 <tag/Function/Return the dimensions of the text mode screen.
5042 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5043 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5044 <tag/Description/The function returns the dimensions of the text mode screen.
5045 <tag/Notes/<itemize>
5046 <item>The function is only available as fastcall function, so it may only
5047 be used in presence of a prototype.
5049 <tag/Availability/cc65
5051 <ref id="gotox" name="gotox">,
5052 <ref id="gotoxy" name="gotoxy">,
5053 <ref id="gotoy" name="gotoy">,
5054 <ref id="wherex" name="wherex">,
5055 <ref id="wherey" name="wherey">
5061 <sect1>seekdir<label id="seekdir"><p>
5065 <tag/Function/Set the position of a directory stream.
5066 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5067 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5068 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5069 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5070 value returned by <tt/<ref id="telldir" name="telldir">/.
5071 <tag/Notes/<itemize>
5072 <item>The function is only available as fastcall function, so it may only
5073 be used in presence of a prototype.
5075 <tag/Availability/POSIX 1003.1
5077 <ref id="rewinddir" name="rewinddir">,
5078 <ref id="telldir" name="telldir">
5084 <sect1>ser_close<label id="ser_close"><p>
5088 <tag/Function/Close the port and disable interrupts
5089 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5090 <tag/Declaration/<tt/unsigned char ser_close (void);/
5091 <tag/Description/Close the port by clearing buffers and disable interrupts.
5092 <tag/Availability/cc65
5093 <tag/See also/Other serial functions.
5098 static void initialize(){
5099 struct ser_params params = {
5106 ser_install(lynx_comlynx); // This will activate the ComLynx
5108 ser_open(&params);
5115 <sect1>ser_get<label id="ser_get"><p>
5119 <tag/Function/Read a character from serial port.
5120 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5121 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5122 <tag/Description/Get a character from the serial port. If no characters are
5123 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5125 <tag/Notes/<itemize>
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/cc65
5130 <tag/See also/Other serial functions.
5132 Wait for a character to be available from a serial port.
5135 while (ser_get(&ch) == SER_ERR_NO_DATA)
5142 <sect1>ser_install<label id="ser_install"><p>
5146 <tag/Function/Install an already loaded driver and return an error code.
5147 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5148 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5149 <tag/Description/The function installs a driver that was already loaded into
5150 memory (or linked statically to the program). It returns an error code
5151 (<tt/SER_ERR_OK/ in case of success).
5152 <tag/Notes/<itemize>
5153 <item>The function is only available as fastcall function, so it may only be
5154 used in presence of a prototype.
5156 <tag/Availability/cc65
5158 <ref id="ser_load_driver" name="ser_load_driver">,
5159 <ref id="ser_uninstall" name="ser_uninstall">,
5160 <ref id="ser_unload" name="ser_unload">
5162 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5168 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5172 <tag/Function/Platform dependent code extensions.
5173 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5174 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5175 <tag/Description/Some platforms have extra serial functions that are not
5176 supported by standard serial driver functions. You can extend the driver to support
5177 this extra functionality bt using ser_ioctl functions.
5178 <tag/Notes/<itemize>
5179 <item>The function is only available as fastcall function, so it may only
5180 be used in presence of a prototype.
5181 <item>These functions are not easily portable to other cc65 platforms.
5183 <tag/Availability/cc65
5184 <tag/See also/Other serial functions.
5189 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5193 <tag/Function/Load and install a serial driver.
5194 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5195 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5196 <tag/Description/Load and install the driver by name.
5197 Will just load the driver and check if loading was successful.
5198 <tag/Notes/<itemize>
5199 <item>The function is only available as fastcall function, so it may only
5200 be used in presence of a prototype.
5202 <tag/Availability/cc65
5203 <tag/See also/Other serial functions.
5209 <sect1>ser_open<label id="ser_open"><p>
5213 <tag/Function/Open the port by setting the port parameters and enable interrupts
5214 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5215 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5216 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5217 <tag/Notes/<itemize>
5218 <item>The function is only available as fastcall function, so it may only
5219 be used in presence of a prototype.
5221 <tag/Availability/cc65
5222 <tag/See also/Other serial functions.
5227 static void initialize(){
5228 struct ser_params params = {
5235 ser_install(lynx_comlynx); // This will activate the ComLynx
5237 ser_open(&params);
5244 <sect1>ser_put<label id="ser_put"><p>
5248 <tag/Function/Write a character to a serial port.
5249 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5250 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5251 <tag/Description/Send a character via the serial port. There is a transmit
5252 buffer, but transmitting is not done via interrupt. The function returns
5253 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5254 <tag/Notes/<itemize>
5255 <item>The function is only available as fastcall function, so it may only
5256 be used in presence of a prototype.
5258 <tag/Availability/cc65
5259 <tag/See also/Other serial functions.
5268 <sect1>ser_status<label id="ser_status"><p>
5272 <tag/Function/Return the serial port status.
5273 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5274 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5275 <tag/Description/Return the serial port status.
5276 <tag/Notes/<itemize>
5277 <item>The function is only available as fastcall function, so it may only
5278 be used in presence of a prototype.
5280 <tag/Availability/cc65
5281 <tag/See also/Other serial functions.
5287 <sect1>ser_uninstall<label id="ser_uninstall"><p>
5291 <tag/Function/Uninstall the currently loaded driver but do not unload it.
5292 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5293 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
5294 <tag/Description/Uninstall the currently loaded driver but do not unload it.
5295 <tag/Availability/cc65
5296 <tag/See also/Other serial functions.
5301 <sect1>ser_unload<label id="ser_unload"><p>
5305 <tag/Function/Uninstall, then unload the currently loaded driver.
5306 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5307 <tag/Declaration/<tt/unsigned char ser_unload (void);/
5308 <tag/Description/Uninstall, then unload the currently loaded driver.
5309 <tag/Availability/cc65
5310 <tag/See also/Other serial functions.
5316 <sect1>set_brk<label id="set_brk"><p>
5320 <tag/Function/Set the break vector to a user function.
5321 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5322 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
5323 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
5324 program code by letting the vector point to a user written C function. The
5325 runtime library installs a small stub that saves the registers into global
5326 variables that may be accessed (and changed) by the break handler.
5327 <tag/Notes/<itemize>
5328 <item>The function is only available as fastcall function, so it may only
5329 be used in presence of a prototype.
5330 <item>The stub saves the zero page registers used by the C runtime and switches
5331 to a small break handler stack. This means that it is safe to execute C code,
5332 even if C code was interrupted. Be careful however not to use too many local
5333 variables, and do not enable stack checks for the handler function or any other
5334 function called from it.
5335 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
5336 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
5337 otherwise the <tt/BRK/ instruction will get executed over and over again.
5338 <item>The break vector is reset on program termination, so it's not strictly
5339 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
5340 clean-up when exitting the program.
5342 <tag/Availability/cc65
5344 <ref id="reset_brk" name="reset_brk">
5350 <sect1>set_irq<label id="set_irq"><p>
5354 <tag/Function/Set the C level interrupt request vector to the given address.
5355 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5356 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
5357 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
5358 (IRQs) within the program code by letting the vector point to a user written C
5359 function. The runtime library installs a small stub that saves the zero page
5360 registers used by the C runtime before calling the handler function and restores
5361 them after the handler function returns. Additionally the stub temporarily switches
5362 the C runtime stack to the stack area provided as parameter. If the handler function
5363 was set up to handle a "private", "exclusive" interrupt request source it must
5364 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
5365 interrupt request actually stems from that source. In all other cases it must return
5366 the value <tt/IRQ_NOT_HANDLED/.
5367 <tag/Notes/<itemize>
5368 <item>The function is only available as fastcall function, so it may only
5369 be used in presence of a prototype.
5370 <item>The stub saves the registers and zero page locations used by the C runtime
5371 and switches to the provided stack area. As a consequence, there is some
5372 runtime overhead, but it it is safe to execute C code, even if other C code
5373 was interrupted. Be careful however not to call C library functions, and do not
5374 enable stack checks for the handler function or any other function called from
5376 <item>The interrupt vector is reset on program termination, so it's not strictly
5377 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
5378 clean-up when exitting the program.
5380 <tag/Availability/cc65
5382 <ref id="reset_brk" name="reset_brk">,
5383 <ref id="reset_irq" name="reset_irq">,
5384 <ref id="set_brk" name="set_brk">
5390 <sect1>setjmp<label id="setjmp"><p>
5394 <tag/Function/Save the context for use with <tt/longjmp/.
5395 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
5396 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
5397 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
5398 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
5400 <tag/Notes/<itemize>
5401 <item>The function is only available as fastcall function, so it may only
5402 be used in presence of a prototype.
5403 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
5404 <item><tt/setjmp/ will not save the signal context.
5406 <tag/Availability/ISO 9899
5408 <ref id="longjmp" name="longjmp">
5414 <sect1>setlocale<label id="setlocale"><p>
5418 <tag/Function/Selects a locale.
5419 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
5420 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
5421 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
5422 <tag/Notes/<itemize>
5423 <item>The function is only available as fastcall function, so it may only
5424 be used in presence of a prototype.
5425 <item>cc65 supports only the "C" locale, so calling this function to set a
5426 different locale has no effect.
5428 <tag/Availability/ISO 9899
5430 <ref id="localeconv" name="localeconv">,
5431 <ref id="strcoll" name="strcoll">
5432 <ref id="strxfrm" name="strxfrm">
5438 <sect1>signal<label id="signal"><p>
5442 <tag/Function/Install a signal handler.
5443 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5444 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
5445 <tag/Description/<tt/signal/ installs a handler for the given signal. The
5446 handler may either be a user supplied function, or one of the predefined
5447 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
5448 previous value if the signal , or the special function vector SIG_ERR in
5450 <tag/Notes/<itemize>
5451 <item>The function is only available as fastcall function, so it may only
5452 be used in presence of a prototype.
5454 <tag/Availability/ISO 9899
5456 <ref id="abort" name="abort">,
5457 <ref id="raise" name="raise">
5463 <sect1>sleep<label id="sleep"><p>
5467 <tag/Function/Sleep for a specified amount of time.
5468 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
5469 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
5470 <tag/Description/The function will return after the specified number of
5471 seconds have elapsed.
5472 <tag/Notes/<itemize>
5473 <item>The function is only available as fastcall function, so it may only
5474 be used in presence of a prototype.
5476 <tag/Availability/POSIX 1003.1
5482 <sect1>slow<label id="slow"><p>
5486 <tag/Function/Switch the C128 into 1MHz mode.
5487 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
5488 <tag/Declaration/<tt/void slow (void);/
5489 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
5490 will halve the speed compared to fast mode.
5491 <tag/Notes/<itemize>
5492 <item>The function is specific to the C128.
5494 <tag/Availability/C128
5496 <ref id="fast" name="fast">,
5497 <ref id="toggle_videomode" name="toggle_videomode">,
5498 <ref id="videomode" name="videomode">
5504 <sect1>srand<label id="srand"><p>
5508 <tag/Function/Initialize the pseudo random number generator.
5509 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5510 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
5511 <tag/Description/The function initializes the random number generator using
5512 the given seed. On program startup, the generator behaves as if <tt/srand/ has
5513 been called with an argument of 1.
5514 <tag/Notes/<itemize>
5515 <item>The function is only available as fastcall function, so it may only
5516 be used in presence of a prototype.
5518 <tag/Availability/ISO 9899
5520 <ref id="_randomize" name="_randomize">,
5521 <ref id="rand" name="rand">
5527 <sect1>strcasecmp<label id="strcasecmp"><p>
5531 <tag/Function/Compare two strings case insensitive.
5532 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5533 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
5534 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
5535 as parameters without case sensitivity. It returns a value that is less than
5536 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
5537 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
5538 <tag/Notes/<itemize>
5539 <item>The function is only available as fastcall function, so it may only
5540 be used in presence of a prototype.
5541 <item>The function is not available in strict ANSI mode.
5543 <tag/Availability/cc65
5545 <ref id="strcmp" name="strcmp">,
5546 <ref id="strcoll" name="strcoll">,
5547 <ref id="stricmp" name="stricmp">,
5548 <ref id="strncmp" name="strncmp">,
5549 <ref id="strxfrm" name="strxfrm">
5555 <sect1>strcat<label id="strcat"><p>
5559 <tag/Function/Concatentate two strings.
5560 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5561 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
5562 <tag/Description/The <tt/strcat/ function appends a copy of the string
5563 pointed to by s2 (including the terminating null byte) to the end of the
5564 string pointed to by s1. The initial byte of s2 overwrites the null byte at
5566 <tag/Notes/<itemize>
5567 <item>The function is only available as fastcall function, so it may only
5568 be used in presence of a prototype.
5569 <item>If copying takes place between objects that overlap, the behaviour
5572 <tag/Availability/ISO 9899
5574 <ref id="strcpy" name="strcpy">,
5575 <ref id="strncat" name="strncat">,
5576 <ref id="strncpy" name="strncpy">
5582 <sect1>strchr<label id="strchr"><p>
5586 <tag/Function/Search for a character in a string.
5587 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5588 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
5589 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
5590 (converted to a char) in the string pointed to by <tt/s/. The terminating null
5591 byte is considered to be part of the string. Upon completion, the function
5592 returns a pointer to the byte, or a null pointer if the byte was not found.
5593 <tag/Notes/<itemize>
5594 <item>The function is only available as fastcall function, so it may only
5595 be used in presence of a prototype.
5597 <tag/Availability/ISO 9899
5599 <ref id="memchr" name="memchr">,
5600 <ref id="strrchr" name="strrchr">
5606 <sect1>strcmp<label id="strcmp"><p>
5610 <tag/Function/Compare two strings.
5611 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5612 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
5613 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
5614 parameters. It returns a value that is less than zero if <tt/s1/ is less than
5615 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
5616 if <tt/s1/ is greater than <tt/s2/.
5617 <tag/Notes/<itemize>
5618 <item>The function is only available as fastcall function, so it may only
5619 be used in presence of a prototype.
5621 <tag/Availability/ISO 9899
5623 <ref id="strcasecmp" name="strcasecmp">,
5624 <ref id="strcoll" name="strcoll">,
5625 <ref id="stricmp" name="stricmp">,
5626 <ref id="strncmp" name="strncmp">
5627 <ref id="strxfrm" name="strxfrm">
5633 <sect1>strcoll<label id="strcoll"><p>
5637 <tag/Function/Compare two strings.
5638 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5639 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
5640 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
5641 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
5642 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
5643 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
5644 than zero if <tt/s1/ is greater than <tt/s2/.
5645 <tag/Notes/<itemize>
5646 <item>The function is only available as fastcall function, so it may only
5647 be used in presence of a prototype.
5649 <tag/Availability/ISO 9899
5651 <ref id="setlocale" name="setlocale">,
5652 <ref id="strcasecmp" name="strcasecmp">,
5653 <ref id="strcmp" name="strcmp">,
5654 <ref id="stricmp" name="stricmp">,
5655 <ref id="strncmp" name="strncmp">,
5656 <ref id="strxfrm" name="strxfrm">
5662 <sect1>strcpy<label id="strcpy"><p>
5666 <tag/Function/Copy a string.
5667 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5668 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
5669 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
5670 <tt/s2/ (including the terminating null byte) into the array pointed to by
5671 <tt/s1/. The function will always return <tt/s1/.
5672 <tag/Notes/<itemize>
5673 <item>The function is only available as fastcall function, so it may only
5674 be used in presence of a prototype.
5675 <item>If copying takes place between objects that overlap, the behaviour
5678 <tag/Availability/ISO 9899
5680 <ref id="strcat" name="strcat">,
5681 <ref id="strncat" name="strncat">,
5682 <ref id="strncpy" name="strncpy">
5685 #include <string.h>
5687 static char hello[14];
5689 strcpy (hello, "Hello world!\n");
5695 <sect1>strcspn<label id="strcspn"><p>
5699 <tag/Function/Compute the length of a substring.
5700 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5701 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
5702 <tag/Description/The <tt/strcspn/ function computes and returns the length of
5703 the substring pointed to by <tt/s/ which does <em>not</em> consist of
5704 characters contained in the string <tt/set/.
5705 <tag/Notes/<itemize>
5706 <item>The function is only available as fastcall function, so it may only
5707 be used in presence of a prototype.
5709 <tag/Availability/ISO 9899
5711 <ref id="strqtok" name="strqtok">,
5712 <ref id="strspn" name="strspn">,
5713 <ref id="strstr" name="strstr">,
5714 <ref id="strtok" name="strtok">
5720 <sect1>strdup<label id="strdup"><p>
5724 <tag/Function/Allocate a copy of a string on the heap.
5725 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5726 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
5727 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
5728 to hold a copy of <tt/s/ including the terminating zero. If the allocation
5729 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
5730 memory block, and a pointer to the block is returned.
5731 <tag/Notes/<itemize>
5732 <item>The function is only available as fastcall function, so it may only
5733 be used in presence of a prototype.
5734 <item>It is up to the caller to free the allocated memory block.
5736 <tag/Availability/ISO 9899
5738 <ref id="free" name="free">,
5739 <ref id="malloc" name="malloc">
5745 <sect1>strerror<label id="strerror"><p>
5749 <tag/Function/Return a string describing an error code.
5750 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5751 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
5752 <tag/Description/The <tt/strerror/ function returns a string describing the
5753 given error code. If an invalid error code is passed, the string "Unknown
5754 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
5755 <tt/errno/ is left untouched.
5756 <tag/Notes/<itemize>
5757 <item>The function is only available as fastcall function, so it may only
5758 be used in presence of a prototype.
5759 <item>While the return type of the function is a <tt/char*/, the returned
5760 string must not be modified by the caller!
5762 <tag/Availability/ISO 9899
5764 <ref id="_stroserror" name="_stroserror">
5770 <sect1>stricmp<label id="stricmp"><p>
5774 <tag/Function/Compare two strings case insensitive.
5775 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5776 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
5777 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
5778 parameters without case sensitivity. It returns a value that is less than zero
5779 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
5780 value greater than zero if <tt/s1/ is greater than <tt/s2/.
5781 <tag/Notes/<itemize>
5782 <item>The function is only available as fastcall function, so it may only
5783 be used in presence of a prototype.
5784 <item>The function is not available in strict ANSI mode.
5786 <tag/Availability/cc65
5788 <ref id="strcasecmp" name="strcasecmp">,
5789 <ref id="strcmp" name="strcmp">,
5790 <ref id="strcoll" name="strcoll">,
5791 <ref id="strncmp" name="strncmp">,
5792 <ref id="strxfrm" name="strxfrm">
5798 <sect1>strlen<label id="strlen"><p>
5802 <tag/Function/Return the length of a string.
5803 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5804 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
5805 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
5806 string to which s points, not including the terminating null byte.
5807 <tag/Notes/<itemize>
5808 <item>The function is only available as fastcall function, so it may only
5809 be used in presence of a prototype.
5810 <item>When compiling with <tt/-Os/ (inline known standard functions), the
5811 function does not work correctly for strings with more than 255 characters.
5813 <tag/Availability/ISO 9899
5815 <ref id="strcpy" name="strcpy">
5821 <sect1>strlower<label id="strlower"><p>
5825 <tag/Function/Make a string lower case.
5826 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5827 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
5828 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
5829 function to each character of a string. The function will always return <tt/s/.
5830 <tag/Notes/<itemize>
5831 <item>The function is only available as fastcall function, so it may only
5832 be used in presence of a prototype.
5833 <item>The function prototype is unavailable when compiling in strict ANSI mode.
5834 <item>An alias name for this function is <tt/strlwr/.
5836 <tag/Availability/cc65
5838 <ref id="strupper" name="strupper">,
5839 <ref id="tolower" name="tolower">
5845 <sect1>strlwr<label id="strlwr"><p>
5852 <sect1>strncat<label id="strncat"><p>
5856 <tag/Function/Concatentate two strings.
5857 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5858 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
5859 <tag/Description/The <tt/strncat/ function appends not more than n characters
5860 of the string pointed to by s2 to the end of the string pointed to by s1. The
5861 terminating null character at the end of s1 is overwritten. A terminating null
5862 character is appended to the result, even if not all of s2 is appended to s1.
5863 <tag/Notes/<itemize>
5864 <item>The function is only available as fastcall function, so it may only
5865 be used in presence of a prototype.
5866 <item>If copying takes place between objects that overlap, the behaviour
5869 <tag/Availability/ISO 9899
5871 <ref id="strcpy" name="strcpy">,
5872 <ref id="strncat" name="strncat">,
5873 <ref id="strncpy" name="strncpy">
5879 <sect1>strncmp<label id="strncmp"><p>
5883 <tag/Function/Compare two strings.
5884 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5885 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
5886 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
5887 characters of the two strings passed as parameters. It returns a value that is
5888 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
5889 <tt/s2/, zero if they are identical, and a value greater than zero they are
5891 <tag/Notes/<itemize>
5892 <item>The function is only available as fastcall function, so it may only
5893 be used in presence of a prototype.
5895 <tag/Availability/ISO 9899
5897 <ref id="strcasecmp" name="strcasecmp">,
5898 <ref id="strcmp" name="strcmp">,
5899 <ref id="strcoll" name="strcoll">,
5900 <ref id="stricmp" name="stricmp">,
5901 <ref id="strxfrm" name="strxfrm">
5907 <sect1>strncpy<label id="strncpy"><p>
5911 <tag/Function/Copy part of a string.
5912 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5913 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
5914 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
5915 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
5916 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
5917 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
5918 written. The function always will return <tt/s1/.
5919 <tag/Notes/<itemize>
5920 <item>The function is available only as a fastcall function; so, it may be used
5921 only in the presence of a prototype.
5922 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
5923 to by <tt/s2/, the result is <em/not/ null-terminated!
5924 <item>If copying takes place between objects that overlap, the behaviour is
5927 <tag/Availability/ISO 9899
5929 <ref id="memcpy" name="memcpy">,
5930 <ref id="strcat" name="strcat">,
5931 <ref id="strcpy" name="strcpy">,
5932 <ref id="strncat" name="strncat">
5937 static char hello[6];
5939 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
5945 <sect1>strqtok<label id="strqtok"><p>
5949 <tag/Function/Break a string into tokens.
5950 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5951 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
5952 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
5953 tokens, which are delimited by either quotation marks or characters from the
5954 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
5955 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
5956 pointer to the first token in the string <tt/s1/. The following calls must pass
5957 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
5958 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
5959 <tag/Notes/<itemize>
5960 <item>The function is available only as a fastcall function; so, it may be used
5961 only in the presence of a prototype.
5962 <item><tt/strqtok()/ will modify the string <tt/s1/.
5963 <item>The function will forget where it is in the <tt/s1/ string if it is given
5964 a second <tt/s1/ string before it finishes the first one.
5966 <tag/Availability/cc65
5968 <ref id="strcspn" name="strcspn">,
5969 <!-- <ref id="strpbrk" name="strpbrk">, -->
5970 <ref id="strspn" name="strspn">,
5971 <ref id="strtok" name="strtok">
5977 <sect1>strrchr<label id="strrchr"><p>
5981 <tag/Function/Search for a character in a string.
5982 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5983 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
5984 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
5985 (converted to a char) in the string pointed to by <tt/s/. The terminating null
5986 byte is considered to be part of the string. Upon completion, the function
5987 returns a pointer to the byte, or a null pointer if the byte was not found.
5988 <tag/Notes/<itemize>
5989 <item>The function is only available as fastcall function, so it may only
5990 be used in presence of a prototype.
5992 <tag/Availability/ISO 9899
5994 <ref id="strchr" name="strchr">
6000 <sect1>strspn<label id="strspn"><p>
6004 <tag/Function/Compute the length of a substring.
6005 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6006 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6007 <tag/Description/The <tt/strspn/ function computes and returns the length of
6008 the substring pointed to by <tt/s/ which does consist only of characters
6009 contained in the string <tt/set/.
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.
6014 <tag/Availability/ISO 9899
6016 <ref id="strcspn" name="strcspn">,
6017 <ref id="strstr" name="strstr">
6023 <sect1>strstr<label id="strstr"><p>
6027 <tag/Function/Find a substring.
6028 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6029 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6030 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6031 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6032 otherwise it returns <tt/NULL/.
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.
6037 <tag/Availability/ISO 9899
6039 <ref id="strcspn" name="strcspn">,
6040 <ref id="strspn" name="strspn">
6046 <sect1>strtok<label id="strtok"><p>
6050 <tag/Function/Break a string into tokens.
6051 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6052 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6053 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6054 tokens, which are delimited by characters from the string <tt/s2/. The first call
6055 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6056 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6057 the next token in the string. Different sets of delimiters may be used for the
6058 subsequent calls to <tt/strtok()/.
6059 <tag/Notes/<itemize>
6060 <item>The function is only available as fastcall function, so it may only
6061 be used in presence of a prototype.
6062 <item><tt/strtok()/ will modify the string <tt/s1/.
6063 <item>The function will forget where it is in the <tt/s1/ string if it is given
6064 a second <tt/s1/ string before it finishes the first one.
6066 <tag/Availability/ISO 9899
6068 <ref id="strcspn" name="strcspn">,
6069 <!-- <ref id="strpbrk" name="strpbrk">, -->
6070 <ref id="strqtok" name="strqtok">,
6071 <ref id="strspn" name="strspn">
6077 <sect1>strxfrm<label id="strxfrm"><p>
6081 <tag/Function/Transform a string.
6082 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6083 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6084 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6085 s2 and places the resulting string into the string pointed to by s1. The
6086 transformation is such that if the <tt/strcmp/ function is applied to two
6087 transformed strings, it returns a value greater than, equal to, or less than
6088 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6089 same two original strings. No more than n characters are placed into the
6090 resulting array pointed to by s1, including the terminating null character.
6091 <tag/Notes/<itemize>
6092 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6093 the behaviour is undefined.
6094 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6095 <item>The function is only available as fastcall function, so it may only
6096 be used in presence of a prototype.
6097 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6098 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6100 <tag/Availability/ISO 9899
6102 <ref id="strcmp" name="strcmp">,
6103 <ref id="strcoll" name="strcoll">,
6104 <ref id="strncpy" name="strncpy">
6110 <sect1>strupper<label id="strupper"><p>
6114 <tag/Function/Make a string upper case.
6115 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6116 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6117 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6118 function to each character of a string. The function will always return <tt/s/.
6119 <tag/Notes/<itemize>
6120 <item>The function is only available as fastcall function, so it may only
6121 be used in presence of a prototype.
6122 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6123 <item>An alias name for this function is <tt/strupr/.
6125 <tag/Availability/cc65
6127 <ref id="strlower" name="strlower">
6128 <ref id="toupper" name="toupper">
6134 <sect1>strupr<label id="strupr"><p>
6141 <sect1>telldir<label id="telldir"><p>
6145 <tag/Function/Return the current position of a directory stream.
6146 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6147 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6148 <tag/Description/<tt/telldir/ returns the current position of a directory
6149 stream. The return value may be used in subsequent calls to
6150 <tt/<ref id="seekdir" name="seekdir">/.
6151 <tag/Notes/<itemize>
6152 <item>The function is only available as fastcall function, so it may only
6153 be used in presence of a prototype.
6155 <tag/Availability/POSIX 1003.1
6157 <ref id="seekdir" name="seekdir">,
6158 <ref id="telldir" name="telldir">
6164 <sect1>textcolor<label id="textcolor"><p>
6168 <tag/Function/Set the text color.
6169 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6170 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6171 <tag/Description/The function will set a new text color. It returns the old
6172 (current) text color. Text output using any <tt/conio.h/ function will use
6173 the color set by this function.
6174 <tag/Notes/<itemize>
6175 <item>Text colors are system dependent. The function may have no effect
6176 on systems where the text color cannot be changed.
6177 <item>The function is only available as fastcall function, so it may only
6178 be used in presence of a prototype.
6180 <tag/Availability/cc65
6182 <ref id="bgcolor" name="bgcolor">,
6183 <ref id="bordercolor" name="bordercolor">
6189 <sect1>tgi_arc<label id="tgi_arc"><p>
6193 <tag/Function/Draw an elliptic arc in the current color.
6194 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6195 <tag/Declaration/<tt/void __fastcall__ tgi_arc (int x, int y,
6196 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
6197 <tag/Description/The function draws an elliptic arc with center at x/y and
6198 radii rx/ry using the current drawing color. The arc covers the angle
6199 between sa and ea (startangle and endangle), which must be in the range
6201 <tag/Notes/<itemize>
6202 <item>The function is only available as fastcall function, so it may only
6203 be used in presence of a prototype.
6204 <item>The function behaves unexpectedly or may crash if the angles are out
6207 <tag/Availability/cc65
6209 <ref id="tgi_bar" name="tgi_bar">,
6210 <ref id="tgi_circle" name="tgi_circle">,
6211 <ref id="tgi_ellipse" name="tgi_ellipse">,
6212 <ref id="tgi_pieslice" name="tgi_pieslice">,
6213 <ref id="tgi_setcolor" name="tgi_setcolor">
6215 /* Draw the upper half of an ellipse */
6216 tgi_setcolor(TGI_COLOR_BLUE);
6217 tgi_arc (50, 50, 40, 20, 0, 180);
6223 <sect1>tgi_bar<label id="tgi_bar"><p>
6227 <tag/Function/The function fills a rectangle on the drawpage with the current
6229 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6230 <tag/Declaration/<tt/void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);/
6231 <tag/Description/The function fills a rectangle on the drawpage with the current
6233 <tag/Notes/<itemize>
6234 <item>The function is only available as fastcall function, so it may only
6235 be used in presence of a prototype.
6237 <tag/Availability/cc65
6238 <tag/See also/Other tgi function
6240 tgi_setcolor(TGI_COLOR_GREEN);
6241 tgi_bar(10, 10, 100, 60);
6247 <sect1>tgi_circle<label id="tgi_circle"><p>
6251 <tag/Function/The function draws a circle in the current color.
6252 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6253 <tag/Declaration/<tt/void __fastcall__ tgi_circle (int x, int y, unsigned char radius);/
6254 <tag/Description/The function draws a circle in the current color.
6255 <tag/Notes/<itemize>
6256 <item>The function is only available as fastcall function, so it may only
6257 be used in presence of a prototype.
6259 <tag/Availability/cc65
6261 <ref id="tgi_arc" name="tgi_arc">,
6262 <ref id="tgi_bar" name="tgi_bar">,
6263 <ref id="tgi_ellipse" name="tgi_ellipse">,
6264 <ref id="tgi_pieslice" name="tgi_pieslice">,
6265 <ref id="tgi_setcolor" name="tgi_setcolor">
6267 tgi_setcolor(TGI_COLOR_BLACK);
6268 tgi_circle(50, 40, 40);
6274 <sect1>tgi_clear<label id="tgi_clear"><p>
6278 <tag/Function/Clear the drawpage
6279 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6280 <tag/Declaration/<tt/void tgi_clear (void);/
6281 <tag/Description/Clear the drawpage
6282 <tag/Availability/cc65
6283 <tag/See also/Other tgi functions
6289 <sect1>tgi_done<label id="tgi_done"><p>
6293 <tag/Function/End graphics mode, switch back to text mode.
6294 Will NOT uninstall or unload the driver!
6295 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6296 <tag/Declaration/<tt/void tgi_done (void);/
6297 <tag/Description/End graphics mode, switch back to text mode.
6298 Will NOT uninstall or unload the driver!
6299 <tag/Availability/cc65
6300 <tag/See also/Other tgi functions
6306 <sect1>tgi_ellipse<label id="tgi_ellipse"><p>
6310 <tag/Function/The function draws an ellipse in the current color.
6311 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6312 <tag/Declaration/<tt/void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);/
6313 <tag/Description/The function draws an ellipse at position x/y with radii
6314 rx and ry, using the current drawing color.
6315 <tag/Notes/<itemize>
6316 <item>The function is only available as fastcall function, so it may only
6317 be used in presence of a prototype.
6319 <tag/Availability/cc65
6321 <ref id="tgi_arc" name="tgi_arc">,
6322 <ref id="tgi_bar" name="tgi_bar">,
6323 <ref id="tgi_circle" name="tgi_circle">,
6324 <ref id="tgi_pieslice" name="tgi_pieslice">,
6325 <ref id="tgi_setcolor" name="tgi_setcolor">
6327 tgi_setcolor(TGI_COLOR_RED);
6328 tgi_ellipse (50, 40, 40, 20);
6334 <sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p>
6338 <tag/Function/Free a vector font that was previously loaded into memory.
6339 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6340 <tag/Declaration/<tt/void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);/
6341 <tag/Description/Free a vector font that was previously loaded into memory.
6342 <tag/Notes/<itemize>
6343 <item>The function is only available as fastcall function, so it may only
6344 be used in presence of a prototype.
6346 <tag/Availability/cc65
6348 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6349 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
6355 <sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p>
6357 <quote> <descrip> <tag/Function/Return the pixel aspect ratio.
6358 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6359 <tag/Declaration/<tt/unsigned tgi_getaspectratio (void);/
6360 <tag/Description/The function returns the pixel aspect ratio for the current
6361 driver and display as an 8.8 fixed point value. It may be used to correct
6362 geometric shapes so they look correct on the display. As an example, a circle
6363 with a radius of 100 pixels may look elliptic on some driver/display
6364 combinations if the aspect ratio is not 1.00.
6365 <tag/Notes/<itemize>
6366 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
6367 monitor for the given platform. The aspect ratio may be wrong if another
6369 <item>No TGI function will use the aspect ratio. It is up to the programmer to
6371 <item>The <ref id="tgi_setaspectratio" name="tgi_setaspectratio"> function can
6372 be used to change the aspect ratio for a loaded driver. The value is not reset
6373 by <ref id="tgi_init" name="tgi_init">, so if a driver is linked statically to
6374 an application, switching into and out of graphics mode will not restore the
6375 original aspect ratio.
6377 <tag/Availability/cc65
6379 <ref id="tgi_setaspectratio" name="tgi_setaspectratio">
6385 <sect1>tgi_getcolor<label id="tgi_getcolor"><p>
6389 <tag/Function/Return the current drawing color.
6390 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6391 <tag/Declaration/<tt/unsigned char tgi_getcolor (void);/
6392 <tag/Description/The actual color is an index to a palette. During tgi_init
6393 you will get a default palette. The number of colors depend on the platform.
6394 All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some
6395 platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN
6396 and then you change the green of the palette to blue using tgi_setpalette then
6397 after this painting in TGI_COLOR_GREEN will actually be blue.
6398 <tag/Availability/cc65
6399 <tag/See also/Other tgi functions
6401 color = tgi_getcolor();
6407 <sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p>
6411 <tag/Function/Get the number of available colors.
6412 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6413 <tag/Declaration/<tt/unsigned char tgi_getcolorcount (void);/
6414 <tag/Description/Tgi platforms use indexed color palettes. This function
6415 returns the number of entries we can use in the palette.
6416 <tag/Availability/cc65
6417 <tag/See also/Other tgi functions
6419 if (tgi_getcolorcount() == 2) {
6420 printf("Only monochrome graphics is supported\n");
6427 <sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p>
6431 <tag/Function/Get the palette installed by default.
6432 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6433 <tag/Declaration/<tt/const unsigned char* tgi_getdefpalette (void);/
6434 <tag/Description/The tgi driver has a default palette that is active at startup.
6435 The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this
6436 palette to work correctly.
6437 <tag/Availability/cc65
6438 <tag/See also/Other tgi functions
6444 <sect1>tgi_geterror<label id="tgi_geterror"><p>
6448 <tag/Function/Return the error code for the last operation.
6449 This will also clear the error.
6450 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6451 <tag/Declaration/<tt/unsigned char tgi_geterror (void);/
6452 <tag/Description/Return the error code for the last operation.
6453 This will also clear the error.
6454 <tag/Availability/cc65
6455 <tag/See also/Other tgi functions
6461 <sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p>
6465 <tag/Function/Get an error message describing the error.
6466 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6467 <tag/Declaration/<tt/const char* __fastcall__ tgi_geterrormsg (unsigned char code);/
6468 <tag/Description/Get an error message describing the error.
6469 <tag/Notes/<itemize>
6470 <item>The function is only available as fastcall function, so it may only
6471 be used in presence of a prototype.
6473 <tag/Availability/cc65
6474 <tag/See also/Other tgi functions
6480 <sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p>
6484 <tag/Function/Get the highest index of the palette.
6485 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6486 <tag/Declaration/<tt/unsigned char tgi_getmaxcolor (void);/
6487 <tag/Description/Get the highest index of the palette.
6488 <tag/Availability/cc65
6489 <tag/See also/Other tgi functions
6495 <sect1>tgi_getmaxx<label id="tgi_getmaxx"><p>
6499 <tag/Function/Get the maximum x coordinate that can be used on this screen.
6500 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6501 <tag/Declaration/<tt/unsigned tgi_getmaxx (void);/
6502 <tag/Description/Get the maximum x coordinate that can be used on this screen.
6503 <tag/Availability/cc65
6504 <tag/See also/Other tgi functions
6510 <sect1>tgi_getmaxy<label id="tgi_getmaxy"><p>
6514 <tag/Function/Get the maximum y coordinate that can be used on this screen.
6515 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6516 <tag/Declaration/<tt/unsigned tgi_getmaxy (void);/
6517 <tag/Description/Get the maximum y coordinate that can be used on this screen.
6518 <tag/Availability/cc65
6519 <tag/See also/Other tgi functions
6525 <sect1>tgi_getpagecount<label id="tgi_getpagecount"><p>
6529 <tag/Function/Return the number of screen pages available.
6530 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6531 <tag/Declaration/<tt/unsigned tgi_getpagecount (void);/
6532 <tag/Description/Return the number of screen pages available.
6533 <tag/Availability/cc65
6535 <ref id="tgi_setdrawpage" name="tgi_setdrawpage">,
6536 <ref id="tgi_setviewpage" name="tgi_setviewpage">
6542 <sect1>tgi_getpalette<label id="tgi_getpalette"><p>
6546 <tag/Function/Get the palette installed.
6547 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6548 <tag/Declaration/<tt/const unsigned char* tgi_getpalette (void);/
6549 <tag/Description/Get the palette installed.
6550 <tag/Availability/cc65
6551 <tag/See also/Other tgi functions
6557 <sect1>tgi_getpixel<label id="tgi_getpixel"><p>
6561 <tag/Function/Get the color of a pixel from the viewpage.
6562 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6563 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/
6564 <tag/Description/Get the color of a pixel from the viewpage.
6565 <tag/Notes/<itemize>
6566 <item>The function is only available as fastcall function, so it may only
6567 be used in presence of a prototype.
6569 <tag/Availability/cc65
6570 <tag/See also/Other tgi functions.
6576 <sect1>tgi_getxres<label id="tgi_getxres"><p>
6580 <tag/Function/Get number of horisontal pixels on the screen.
6581 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6582 <tag/Declaration/<tt/unsigned tgi_getxres (void);/
6583 <tag/Description/Get number of horisontal pixels on the screen.
6584 This is same as tgi_maxx()+1.
6585 <tag/Availability/cc65
6586 <tag/See also/Other tgi functions.
6592 <sect1>tgi_getyres<label id="tgi_getyres"><p>
6596 <tag/Function/Get number of vertical pixels on the screen.
6597 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6598 <tag/Declaration/<tt/unsigned tgi_getyres (void);/
6599 <tag/Description/Get number of vertical pixels on the screen.
6600 This is same as tgi_maxy()+1.
6601 <tag/Availability/cc65
6602 <tag/See also/Other tgi functions.
6608 <sect1>tgi_gotoxy<label id="tgi_gotoxy"><p>
6612 <tag/Function/Set graphics cursor at x, y.
6613 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6614 <tag/Declaration/<tt/void __fastcall__ tgi_gotoxy (int x, int y);/
6615 <tag/Description/Set graphics cursor at x, y.
6616 <tag/Notes/<itemize>
6617 <item>The function is only available as fastcall function, so it may only
6618 be used in presence of a prototype.
6620 <tag/Availability/cc65
6621 <tag/See also/Other tgi functions.
6627 <sect1>tgi_init<label id="tgi_init"><p>
6631 <tag/Function/Initialize the already loaded graphics driver.
6632 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6633 <tag/Declaration/<tt/void tgi_init (void);/
6634 <tag/Description/The tgi_init function will set the default palette to the
6636 <tag/Notes/<itemize>
6637 <item><tt/tgi_init/ will not clear the screen. This allows switching between
6638 text and graphics mode on platforms that have separate memory areas for the
6639 screens. If you want the screen cleared, call <tt/<ref id="tgi_clear"
6640 name="tgi_clear">/ after <tt/tgi_init/.
6642 <tag/Availability/cc65
6643 <tag/See also/Other tgi functions.
6645 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6646 tgi_init(); //Set up the default palette and clear the screen.
6652 <sect1>tgi_install<label id="tgi_install"><p>
6656 <tag/Function/Install an already loaded driver and return an error code.
6657 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6658 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_install (void* driver);/
6659 <tag/Description/The function installs a driver that was already loaded into
6660 memory (or linked statically to the program). It returns an error code
6661 (<tt/TGI_ERR_OK/ in case of success).
6662 <tag/Notes/<itemize>
6663 <item>The function is only available as fastcall function, so it may only be
6664 used in presence of a prototype.
6666 <tag/Availability/cc65
6668 <ref id="tgi_load_driver" name="tgi_load_driver">,
6669 <ref id="tgi_uninstall" name="tgi_uninstall">,
6670 <ref id="tgi_unload" name="tgi_unload">
6672 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6673 tgi_init(); //Set up the default palette and clear the screen.
6679 <sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p>
6683 <tag/Function/Install an already loaded driver and return an error code.
6684 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6685 <tag/Declaration/<tt/void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);/
6687 Install a vector font for use. More than one vector font can be loaded,
6688 but only one can be active. This function is used to tell which one. Call
6689 with a NULL pointer to uninstall the currently installed font.
6690 <tag/Notes/<itemize>
6691 <item>The function is only available as fastcall function, so it may only be
6692 used in presence of a prototype.
6694 <tag/Availability/cc65
6696 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6697 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
6703 <sect1>tgi_ioctl<label id="tgi_ioctl"><p>
6707 <tag/Function/Platform dependent code extensions.
6708 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6709 <tag/Declaration/<tt/unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);/
6710 <tag/Description/Some platforms have extra display hardware that is not
6711 supported by standard tgi functions. You can extend the driver to support
6712 this extra hardware using tgi_ioctl functions.
6713 <tag/Notes/<itemize>
6714 <item>The function is only available as fastcall function, so it may only
6715 be used in presence of a prototype.
6716 <item>These functions are not easily portable to other cc65 platforms.
6718 <tag/Availability/cc65
6719 <tag/See also/Other tgi functions.
6721 #define tgi_sprite(spr) tgi_ioctl(0, (void*)(spr))
6722 #define tgi_flip() tgi_ioctl(1, (void*)0)
6723 #define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
6724 #define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
6725 #define tgi_busy() tgi_ioctl(4, (void*)0)
6726 #define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
6728 tgi_sprite(&background);
6729 tgi_setcolor(TGI_COLOR_BLUE);
6730 tgi_outttextxy(20,40,"Hello World");
6731 tgi_updatedisplay();
6738 <sect1>tgi_line<label id="tgi_line"><p>
6742 <tag/Function/Draw a line in the current drawing color.
6743 The graphics cursor will be set to x2/y2 by this call.
6744 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6745 <tag/Declaration/<tt/void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);/
6746 <tag/Description/Draw a line in the current drawing color.
6747 The graphics cursor will be set to x2/y2 by this call.
6748 <tag/Notes/<itemize>
6749 <item>The function is only available as fastcall function, so it may only
6750 be used in presence of a prototype.
6752 <tag/Availability/cc65
6753 <tag/See also/Other tgi functions.
6759 <sect1>tgi_lineto<label id="tgi_lineto"><p>
6763 <tag/Function/Draw a line in the current drawing color from the graphics
6764 cursor to the new end point. The graphics cursor will be updated to x2/y2.
6765 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6766 <tag/Declaration/<tt/void __fastcall__ tgi_lineto (int x2, int y2);/
6767 <tag/Description/Draw a line in the current drawing color from the graphics
6768 cursor to the new end point. The graphics cursor will be updated to x2/y2.
6769 <tag/Notes/<itemize>
6770 <item>The function is only available as fastcall function, so it may only
6771 be used in presence of a prototype.
6773 <tag/Availability/cc65
6774 <tag/See also/Other tgi functions.
6780 <sect1>tgi_load_driver<label id="tgi_load_driver"><p>
6784 <tag/Function/Load and install the given driver.
6785 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6786 <tag/Declaration/<tt/void __fastcall__ tgi_load_driver (const char *name);/
6787 <tag/Description/Load and install the driver by name.
6788 Will just load the driver and check if loading was successful.
6789 Will not switch to graphics mode.
6790 <tag/Notes/<itemize>
6791 <item>The function is only available as fastcall function, so it may only
6792 be used in presence of a prototype.
6794 <tag/Availability/cc65
6795 <tag/See also/Other tgi functions.
6801 <sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p>
6805 <tag/Function/Load the given vector font.
6806 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6807 <tag/Declaration/<tt/const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);/
6809 Load a vector font into memory and return it. In case of errors, NULL is
6810 returned and an error is set, which can be retrieved using tgi_geterror.
6811 To use the font, it has to be installed using tgi_install_vectorfont.
6812 <tag/Notes/<itemize>
6813 <item>The function is only available as fastcall function, so it may only
6814 be used in presence of a prototype.
6816 <tag/Availability/cc65
6818 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">,
6819 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
6825 <sect1>tgi_outtext<label id="tgi_outtext"><p>
6829 <tag/Function/Output text at the current graphics cursor position.
6830 The graphics cursor is moved to the end of the text.
6831 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6832 <tag/Declaration/<tt/void __fastcall__ tgi_outtext (const char* s);/
6833 <tag/Description/Output text at the current graphics cursor position.
6834 The graphics cursor is moved to the end of the text.
6835 <tag/Notes/<itemize>
6836 <item>The function is only available as fastcall function, so it may only
6837 be used in presence of a prototype.
6839 <tag/Availability/cc65
6840 <tag/See also/Other tgi functions.
6846 <sect1>tgi_outtextxy<label id="tgi_outtextxy"><p>
6850 <tag/Function/Output text at the given cursor position.
6851 The graphics cursor is moved to the end of the text.
6852 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6853 <tag/Declaration/<tt/void __fastcall__ tgi_outtextxy (int x, int y, const char* s);/
6854 <tag/Description/Output text at the given cursor position.
6855 The graphics cursor is moved to the end of the text.
6856 <tag/Notes/<itemize>
6857 <item>The function is only available as fastcall function, so it may only
6858 be used in presence of a prototype.
6860 <tag/Availability/cc65
6861 <tag/See also/Other tgi functions.
6867 <sect1>tgi_pieslice<label id="tgi_pieslice"><p>
6871 <tag/Function/Draw an elliptic pie slice in the current color.
6872 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6873 <tag/Declaration/<tt/void __fastcall__ tgi_pie slice (int x, int y,
6874 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
6875 <tag/Description/The function draws an elliptic pie slice with center at x/y
6876 and radii rx/ry using the current drawing color. The pie slice covers the angle
6877 between sa and ea (startangle and endangle), which must be in the range
6879 <tag/Notes/<itemize>
6880 <item>The function is only available as fastcall function, so it may only
6881 be used in presence of a prototype.
6882 <item>The function behaves unexpectedly or may crash if the angles are out
6885 <tag/Availability/cc65
6887 <ref id="tgi_bar" name="tgi_arc">,
6888 <ref id="tgi_bar" name="tgi_bar">,
6889 <ref id="tgi_circle" name="tgi_circle">,
6890 <ref id="tgi_ellipse" name="tgi_ellipse">,
6891 <ref id="tgi_setcolor" name="tgi_setcolor">
6893 /* Draw the closed upper half of an ellipse */
6894 tgi_setcolor(TGI_COLOR_BLUE);
6895 tgi_pieslice (50, 50, 40, 20, 0, 180);
6901 <sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p>
6903 <quote> <descrip> <tag/Function/Set the pixel aspect ratio.
6904 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6905 <tag/Declaration/<tt/void __fastcall__ tgi_setaspectratio (unsigned ratio);/
6906 <tag/Description/The function sets the pixel aspect ratio for the current
6907 driver and display. The argument is an 8.8 fixed point value. The aspect ratio
6908 may be used to correct geometric shapes so they look correct on a given
6909 display. As an example, a circle with a radius of 100 pixels may look elliptic
6910 on some driver/display combinations if the aspect ratio is not 1.00.
6911 <tag/Notes/<itemize>
6912 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
6913 monitor for the given platform. The aspect ratio may be wrong if another
6915 <item>No TGI function will use the aspect ratio. It is up to the programmer to
6917 <item>The <tt/tgi_setaspectratio/ function can be used to change the aspect
6918 ratio for a loaded driver. The value is not reset by <ref id="tgi_init"
6919 name="tgi_init">, so if a driver is linked statically to an application,
6920 switching into and out of graphics mode will not restore the original aspect
6923 <tag/Availability/cc65
6925 <ref id="tgi_getaspectratio" name="tgi_getaspectratio">
6931 <sect1>tgi_setcolor<label id="tgi_setcolor"><p>
6935 <tag/Function/Set color to be used in future draw operations.
6936 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6937 <tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/
6938 <tag/Description/Set color to be used in future draw operations.
6939 <tag/Notes/<itemize>
6940 <item>The function is only available as fastcall function, so it may only
6941 be used in presence of a prototype.
6943 <tag/Availability/cc65
6944 <tag/See also/Other tgi functions.
6946 tgi_setcolor(TGI_COLOR_BLACK);
6948 tgi_setcolor(TGI_COLOR_WHITE);
6949 tgi_bar(10,10,20,20);
6954 <sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p>
6958 <tag/Function/Set the page for drawing.
6959 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6960 <tag/Declaration/<tt/void __fastcall__ tgi_setdrawpage (unsigned char page);/
6961 <tag/Description/If the drawpage and the viewpage are the same then all drawing
6962 is seen immediately as it is drawn. For double buffered games you can set the
6963 drawpage to a different page than the viewpage. This lets you draw the next
6964 screen in the background and when the screen is ready you display it.
6965 <tag/Notes/<itemize>
6966 <item>The function is only available as fastcall function, so it may only
6967 be used in presence of a prototype.
6969 <tag/Availability/cc65
6970 <tag/See also/Other tgi functions.
6973 tgi_outtextxy(10, 10, "Hello World");
6974 tgi_setviewpage(1); // Show page 1
6976 tgi_outtextxy(10, 10, "Creating next frame");
6978 tgi_setviewpage(0); // Show page 0
6983 <sect1>tgi_setpalette<label id="tgi_setpalette"><p>
6987 <tag/Function/Set the palette (not available with all drivers/hardware).
6988 Palette is a pointer to as many entries as there are colors.
6989 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6990 <tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/
6991 <tag/Description/Set the palette (not available with all drivers/hardware).
6992 Palette is a pointer to as many entries as there are colors.
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.
7003 <sect1>tgi_setpixel<label id="tgi_setpixel"><p>
7007 <tag/Function/Plot a pixel on the drawpage with the current color.
7008 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7009 <tag/Declaration/<tt/void __fastcall__ tgi_setpixel (int x, int y);/
7010 <tag/Description/Plot a pixel on the drawpage with the current color.
7011 <tag/Notes/<itemize>
7012 <item>The function is only available as fastcall function, so it may only
7013 be used in presence of a prototype.
7015 <tag/Availability/cc65
7016 <tag/See also/Other tgi functions.
7021 <sect1>tgi_setviewpage<label id="tgi_setviewpage"><p>
7025 <tag/Function/Set page to be visible on screen.
7026 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7027 <tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/
7028 <tag/Description/If the drawpage and the viewpage are the same then all drawing
7029 is seen immediately as it is drawn. For double buffered games you can set the
7030 drawpage to a different page than the viewpage. This lets you draw the next
7031 screen in the background and when the screen is ready you display it.
7032 <tag/Notes/<itemize>
7033 <item>The function is only available as fastcall function, so it may only
7034 be used in presence of a prototype.
7036 <tag/Availability/cc65
7037 <tag/See also/Other tgi functions.
7040 tgi_outtextxy(10, 10, "Hello World");
7041 tgi_setviewpage(1); // Show page 1
7043 tgi_outtextxy(10, 10, "Creating next frame");
7045 tgi_setviewpage(0); // Show page 0
7050 <sect1>tgi_gettextheight<label id="tgi_gettextheight"><p>
7054 <tag/Function/Calculate the height of the text in pixels according to
7055 the current text style.
7056 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7057 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/
7058 <tag/Description/Calculate the height of the text in pixels according to
7059 the current text style.
7060 <tag/Notes/<itemize>
7061 <item>The function is only available as fastcall function, so it may only
7062 be used in presence of a prototype.
7064 <tag/Availability/cc65
7065 <tag/See also/Other tgi functions.
7070 <sect1>tgi_settextscale<label id="tgi_settextscale"><p>
7074 <tag/Function/Set the scaling for text output.
7075 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7076 <tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/
7078 Set the scaling for text output. The scaling factors for width and height
7079 are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
7080 <tag/Notes/<itemize>
7081 <item>The function is only available as fastcall function, so it may only
7082 be used in presence of a prototype.
7084 <tag/Availability/cc65
7086 <ref id="tgi_settextstyle" name="tgi_settextstyle">
7091 <sect1>tgi_settextstyle<label id="tgi_settextstyle"><p>
7095 <tag/Function/Set the style for text output.
7096 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7097 <tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/
7098 <tag/Description/Set the style for text output.
7099 <tag/Notes/<itemize>
7100 <item>The function is only available as fastcall function, so it may only
7101 be used in presence of a prototype.
7103 <tag/Availability/cc65
7105 <ref id="tgi_settextscale" name="tgi_settextscale">
7110 <sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p>
7114 <tag/Function/Calculate the width of the text in pixels according to the current text style.
7115 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7116 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/
7117 <tag/Description/Calculate the width of the text in pixels according to the current text style.
7118 <tag/Notes/<itemize>
7119 <item>The function is only available as fastcall function, so it may only
7120 be used in presence of a prototype.
7122 <tag/Availability/cc65
7123 <tag/See also/Other tgi functions.
7128 <sect1>tgi_uninstall<label id="tgi_uninstall"><p>
7132 <tag/Function/Uninstall the currently loaded driver but do not unload it.
7133 Will call tgi_done if necessary.
7134 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7135 <tag/Declaration/<tt/void tgi_uninstall (void);/
7136 <tag/Description/Uninstall the currently loaded driver but do not unload it.
7137 Will call tgi_done if necessary.
7138 <tag/Availability/cc65
7139 <tag/See also/Other tgi functions.
7144 <sect1>tgi_unload<label id="tgi_unload"><p>
7148 <tag/Function/Uninstall, then unload the currently loaded driver.
7149 Will call tgi_done if necessary.
7150 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7151 <tag/Declaration/<tt/void tgi_unload (void);/
7152 <tag/Description/Uninstall, then unload the currently loaded driver.
7153 Will call tgi_done if necessary.
7154 <tag/Availability/cc65
7155 <tag/See also/Other tgi functions.
7160 <sect1>time<label id="time"><p>
7164 <tag/Function/Get the time.
7165 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7166 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7167 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7168 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7169 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7170 returned and <tt/errno/ is set to <tt/ENOSYS/.
7171 <tag/Notes/<itemize>
7172 <item>The function is only available as fastcall function, so it may
7173 only be used in presence of a prototype.
7174 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7175 returned value may not be valid.
7177 <tag/Availability/ISO 9899
7179 <ref id="clock" name="clock">
7185 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7189 <tag/Function/Toggle between 40 and 80 column mode.
7190 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7191 <tag/Declaration/<tt/void toggle_videomode (void);/
7192 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7193 old mode (cursor position, color and so on) are saved and restored together
7195 <tag/Notes/<itemize>
7196 <item>The function is specific to the C128.
7197 <item>This function is deprecated. Please use <ref id="videomode"
7198 name="videomode"> instead!
7200 <tag/Availability/C128
7202 <ref id="fast" name="fast">,
7203 <ref id="slow" name="slow">,
7204 <ref id="videomode" name="videomode">
7210 <sect1>tolower<label id="tolower"><p>
7214 <tag/Function/Convert a character into its lower case representation.
7215 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7216 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7217 <tag/Description/The function returns the given character converted to lower
7218 case. If the given character is not a letter, it is returned unchanged.
7219 <tag/Notes/<itemize>
7220 <item>The function is only available as fastcall function, so it may
7221 only be used in presence of a prototype.
7223 <tag/Availability/ISO 9899
7225 <ref id="islower" name="islower">,
7226 <ref id="isupper" name="isupper">,
7227 <ref id="toupper" name="toupper">
7233 <sect1>toupper<label id="toupper"><p>
7237 <tag/Function/Convert a character into its upper case representation.
7238 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7239 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7240 <tag/Description/The function returns the given character converted to upper
7241 case. If the given character is not a letter, it is returned unchanged.
7242 <tag/Notes/<itemize>
7243 <item>The function is only available as fastcall function, so it may
7244 only be used in presence of a prototype.
7246 <tag/Availability/ISO 9899
7248 <ref id="islower" name="islower">,
7249 <ref id="isupper" name="isupper">,
7250 <ref id="tolower" name="tolower">
7256 <sect1>ultoa<label id="ultoa"><p>
7260 <tag/Function/Convert an unsigned long integer into a string.
7261 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7262 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7263 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7264 string using <tt/radix/ as the base.
7265 <tag/Notes/<itemize>
7266 <item>There are no provisions to prevent a buffer overflow.
7267 <item>The function is non standard, so it is not available in strict ANSI mode.
7268 You should probably use <tt/sprintf/ instead.
7269 <item>The function is only available as fastcall function, so it may only be
7270 used in presence of a prototype.
7272 <tag/Availability/cc65
7274 <ref id="atoi" name="atoi">,
7275 <ref id="atol" name="atol">,
7276 <ref id="itoa" name="itoa">,
7277 <ref id="ltoa" name="ltoa">,
7278 <ref id="utoa" name="utoa">
7284 <sect1>unlink<label id="unlink"><p>
7288 <tag/Function/Delete a file.
7289 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7290 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7291 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7292 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7293 code describing the reason for the failure.
7294 <tag/Notes/<itemize>
7295 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7296 name="remove">/ instead, which is a native ANSI C function and does the same.
7297 <item>This function is not available on all cc65 targets (depends on the
7298 availability of file I/O).
7299 <item>The function is only available as fastcall function, so it may only
7300 be used in presence of a prototype.
7301 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7302 used, which has the same semantics, but is more portable, because it conforms
7303 to the ISO C standard.
7305 <tag/Availability/POSIX 1003.1
7307 <ref id="remove" name="remove">
7310 #include <stdio.h>
7311 #include <unistd.h>
7313 #define FILENAME "helloworld"
7315 if (unlink (FILENAME) == 0) {
7316 printf ("We deleted %s successfully\n", FILENAME);
7318 printf ("There was a problem deleting %s\n", FILENAME);
7325 <sect1>utoa<label id="utoa"><p>
7329 <tag/Function/Convert an unsigned integer into a string.
7330 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7331 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7332 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7333 using <tt/radix/ as the base.
7334 <tag/Notes/<itemize>
7335 <item>There are no provisions to prevent a buffer overflow.
7336 <item>The function is non standard, so it is not available in strict ANSI mode.
7337 You should probably use <tt/sprintf/ instead.
7338 <item>The function is only available as fastcall function, so it may only be
7339 used in presence of a prototype.
7341 <tag/Availability/cc65
7343 <ref id="atoi" name="atoi">,
7344 <ref id="atol" name="atol">,
7345 <ref id="itoa" name="itoa">,
7346 <ref id="ltoa" name="ltoa">,
7347 <ref id="ultoa" name="ultoa">
7353 <sect1>vcprintf<label id="vcprintf"><p>
7357 <tag/Function/Formatted output to the console.
7358 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7359 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7360 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7361 text where necessary and formatted according to the format string given. The
7362 resulting string is output to the console. <tt/vcprintf/ supports the same
7363 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7364 <tag/Notes/<itemize>
7365 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7366 between <tt/\r/ and <tt/\n/.
7367 <item>The function is only available as fastcall function, so it may only be
7368 used in presence of a prototype.
7370 <tag/Availability/cc65
7372 <ref id="cprintf" name="cprintf">,
7373 <ref id="cputc" name="cputc">,
7374 <ref id="cputcxy" name="cputcxy">,
7375 <ref id="cputs" name="cputs">,
7376 <ref id="cputsxy" name="cputsxy">
7382 <sect1>videomode<label id="videomode"><p>
7386 <tag/Function/Switch to either 40 or 80 column mode.
7387 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7388 <ref id="c128.h" name="c128.h">/
7389 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7390 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7391 the requested mode is already active, nothing happens. The old mode is returned
7393 <tag/Notes/<itemize>
7394 <item>The function is specific to the C128 and enhanced Apple //e.
7395 <item>This function replaces <ref id="toggle_videomode"
7396 name="toggle_videomode">.
7397 <item>The function is only available as fastcall function, so it may only be
7398 used in presence of a prototype.
7400 <tag/Availability/C128 and enhanced Apple //e
7402 <ref id="fast" name="fast">,
7403 <ref id="slow" name="slow">,
7404 <ref id="toggle_videomode" name="toggle_videomode">
7410 <sect1>wherex<label id="wherex"><p>
7414 <tag/Function/Return the current X position of the text mode cursor.
7415 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7416 <tag/Declaration/<tt/unsigned char wherex (void);/
7417 <tag/Description/The function returns the current X position of the text mode
7418 cursor. Zero is returned for the leftmost screen position.
7419 <tag/Availability/cc65
7421 <ref id="gotox" name="gotox">,
7422 <ref id="gotoy" name="gotoy">,
7423 <ref id="gotoxy" name="gotoxy">,
7424 <ref id="wherey" name="wherey">
7430 <sect1>wherey<label id="wherey"><p>
7434 <tag/Function/Return the current Y position of the text mode cursor.
7435 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7436 <tag/Declaration/<tt/unsigned char wherey (void);/
7437 <tag/Description/The function returns the current Y position of the text mode
7438 cursor. Zero is returned for the uppermost screen position.
7439 <tag/Availability/cc65
7441 <ref id="gotox" name="gotox">,
7442 <ref id="gotoy" name="gotoy">,
7443 <ref id="gotoxy" name="gotoxy">,
7444 <ref id="wherex" name="wherex">