1 <!doctype linuxdoc system> <!-- -*- text-mode -*- -->
4 <title>cc65 function reference
5 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
6 <url url="mailto:greg.king5@verizon.net" name="Greg King">
10 cc65 is a C compiler for 6502 based systems. This function reference describes
11 the C functions available in the standard library.
14 <!-- Table of contents -->
17 <!-- Begin the document -->
21 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
22 C standard plus additional functions specially crafted for 6502 systems or
23 just some of the supported machines. This function refrence describes the
24 available functions together with any limitations.
26 For an overview about the available libraries, their purpose, and any
27 differences to the ISO standard, please have a look at the <url
28 url="library.html" name="cc65 Library Overview">.
30 <em/Note:/ Standard C functions are listed here, but not described in detail.
31 Since these functions behave identical on all standard compliant systems, they
32 are described in any book covering standard C.
34 Each entry for a function contains a detailed description
38 <tag/Function/Summary of what <bf/function/ does.
39 <tag/Header/The header file that contains the declaration.
40 <tag/Declaration/Describes the needed header files and declaration of the
42 <tag/Description/Description of the function.
43 <tag/Notes/Notes on the function.
44 <tag/Availability/The availability of the function.
45 <tag/See also/Other related functions.
46 <tag/Example/A piece of actual code using the function.
51 <sect>Functions by header file<p>
53 <sect1><tt/6502.h/<label id="6502.h"><p>
56 <item><ref id="BRK" name="BRK">
57 <item><ref id="CLI" name="CLI">
58 <item><ref id="SEI" name="SEI">
59 <item><ref id="_sys" name="_sys">
60 <item><ref id="getcpu" name="getcpu">
61 <item><ref id="reset_brk" name="reset_brk">
62 <item><ref id="reset_irq" name="reset_irq">
63 <item><ref id="set_brk" name="set_brk">
64 <item><ref id="set_irq" name="set_irq">
68 <sect1><tt/apple2.h/<label id="apple2.h"><p>
72 <item><ref id="get_ostype" name="get_ostype">
77 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
81 <item><ref id="get_ostype" name="get_ostype">
85 <item><ref id="videomode" name="videomode">
89 <sect1><tt/assert.h/<label id="assert.h"><p>
92 <item><ref id="assert" name="assert">
96 <sect1><tt/atari.h/<label id="atari.h"><p>
99 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
100 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
101 <!-- <item><ref id="_graphics" name="_graphics"> -->
102 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
103 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
104 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
105 <!-- <item><ref id="_scroll" name="_scroll"> -->
106 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
107 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
108 <item><ref id="get_ostype" name="get_ostype">
109 <!-- <item><ref id="get_tv" name="get_tv"> -->
115 <sect1><tt/atmos.h/<label id="atmos.h"><p>
118 <item><ref id="atmos_load" name="atmos_load">
119 <item><ref id="atmos_save" name="atmos_save">
120 <!-- <item><ref id="atmos_explode" name="atmos_explode"> -->
121 <!-- <item><ref id="atmos_ping" name="atmos_ping"> -->
122 <!-- <item><ref id="atmos_shoot" name="atmos_shoot"> -->
123 <!-- <item><ref id="atmos_tick" name="atmos_tick"> -->
124 <!-- <item><ref id="atmos_tock" name="atmos_tock"> -->
125 <!-- <item><ref id="atmos_zap" name="atmos_zap"> -->
131 <sect1><tt/c128.h/<label id="c128.h"><p>
134 <item><ref id="c64mode" name="c64mode">
135 <item><ref id="fast" name="fast">
136 <item><ref id="slow" name="slow">
137 <item><ref id="toggle_videomode" name="toggle_videomode">
138 <item><ref id="videomode" name="videomode">
142 <sect1><tt/c16.h/<label id="c16.h"><p>
147 <sect1><tt/c64.h/<label id="c64.h"><p>
150 <item><ref id="get_ostype" name="get_ostype">
154 <sect1><tt/cbm.h/<label id="cbm.h"><p>
157 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
158 <item><ref id="cbm_k_basin" name="cbm_k_basin">
159 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
160 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
161 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
162 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
163 <item><ref id="cbm_k_clall" name="cbm_k_clall">
164 <item><ref id="cbm_k_close" name="cbm_k_close">
165 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
166 <item><ref id="cbm_k_getin" name="cbm_k_getin">
167 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
168 <item><ref id="cbm_k_listen" name="cbm_k_listen">
169 <item><ref id="cbm_k_load" name="cbm_k_load">
170 <item><ref id="cbm_k_open" name="cbm_k_open">
171 <item><ref id="cbm_k_readst" name="cbm_k_readst">
172 <item><ref id="cbm_k_save" name="cbm_k_save">
173 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
174 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
175 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
176 <item><ref id="cbm_k_talk" name="cbm_k_talk">
177 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
178 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
179 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
180 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
181 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
182 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
183 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
184 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
185 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
186 <!-- <item><ref id="get_tv" name="get_tv"> -->
187 <item><ref id="waitvsync" name="waitvsync">
188 <item><ref id="kbrepeat" name="kbrepeat">
194 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
197 <item><ref id="peekbsys" name="peekbsys">
198 <item><ref id="peekwsys" name="peekwsys">
199 <item><ref id="pokebsys" name="pokebsys">
200 <item><ref id="pokewsys" name="pokewsys">
204 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
207 <item><ref id="peekbsys" name="peekbsys">
208 <item><ref id="peekwsys" name="peekwsys">
209 <item><ref id="pokebsys" name="pokebsys">
210 <item><ref id="pokewsys" name="pokewsys">
214 <sect1><tt/cc65.h/<label id="cc65.h"><p>
217 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
218 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
219 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
220 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
221 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
222 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
223 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
224 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
225 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
226 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
232 <sect1><tt/conio.h/<label id="conio.h"><p>
235 <item><ref id="bgcolor" name="bgcolor">
236 <item><ref id="bordercolor" name="bordercolor">
237 <item><ref id="cclear" name="cclear">
238 <item><ref id="cclearxy" name="cclearxy">
239 <item><ref id="cgetc" name="cgetc">
240 <item><ref id="chline" name="chline">
241 <item><ref id="chlinexy" name="chlinexy">
242 <item><ref id="clrscr" name="clrscr">
243 <item><ref id="cprintf" name="cprintf">
244 <item><ref id="cputc" name="cputc">
245 <item><ref id="cputcxy" name="cputcxy">
246 <item><ref id="cputs" name="cputs">
247 <item><ref id="cputsxy" name="cputsxy">
248 <item><ref id="cursor" name="cursor">
249 <item><ref id="cvline" name="cvline">
250 <item><ref id="cvlinexy" name="cvlinexy">
251 <item><ref id="gotox" name="gotox">
252 <item><ref id="gotoxy" name="gotoxy">
253 <item><ref id="gotoy" name="gotoy">
254 <item><ref id="kbhit" name="kbhit">
255 <item><ref id="revers" name="revers">
256 <item><ref id="screensize" name="screensize">
257 <item><ref id="textcolor" name="textcolor">
258 <item><ref id="vcprintf" name="vcprintf">
259 <item><ref id="wherex" name="wherex">
260 <item><ref id="wherey" name="wherey">
264 <sect1><tt/ctype.h/<label id="ctype.h"><p>
267 <item><ref id="isalnum" name="isalnum">
268 <item><ref id="isalpha" name="isalpha">
269 <item><ref id="isascii" name="isascii">
270 <item><ref id="isblank" name="isblank">
271 <item><ref id="iscntrl" name="iscntrl">
272 <item><ref id="isdigit" name="isdigit">
273 <item><ref id="isgraph" name="isgraph">
274 <item><ref id="islower" name="islower">
275 <item><ref id="isprint" name="isprint">
276 <item><ref id="ispunct" name="ispunct">
277 <item><ref id="isspace" name="isspace">
278 <item><ref id="isupper" name="isupper">
279 <item><ref id="isxdigit" name="isxdigit">
280 <item><ref id="tolower" name="tolower">
281 <item><ref id="toupper" name="toupper">
285 <sect1><tt/dbg.h/<label id="dbg.h"><p>
288 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
294 <sect1><tt/dio.h/<label id="dio.h"><p>
296 <url url="dio.html" name="Low-level disk I/O API">.
299 <sect1><tt/dirent.h/<label id="dirent.h"><p>
302 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
303 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
304 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
305 <item><ref id="_DE_ISREG" name="_DE_ISREG">
306 <item><ref id="closedir" name="closedir">
307 <item><ref id="opendir" name="opendir">
308 <item><ref id="readdir" name="readdir">
309 <item><ref id="rewinddir" name="rewinddir">
310 <item><ref id="seekdir" name="seekdir">
311 <item><ref id="telldir" name="telldir">
317 <sect1><tt/em.h/<label id="em.h"><p>
320 <item><ref id="em_commit" name="em_commit">
321 <item><ref id="em_copyfrom" name="em_copyfrom">
322 <item><ref id="em_copyto" name="em_copyto">
323 <item><ref id="em_install" name="em_install">
324 <item><ref id="em_load_driver" name="em_load_driver">
325 <item><ref id="em_map" name="em_map">
326 <item><ref id="em_pagecount" name="em_pagecount">
327 <item><ref id="em_uninstall" name="em_uninstall">
328 <item><ref id="em_unload" name="em_unload">
329 <item><ref id="em_use" name="em_use">
333 <sect1><tt/errno.h/<label id="errno.h"><p>
336 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
337 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
338 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
339 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
345 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
348 <item><ref id="close" name="close">
349 <item><ref id="creat" name="creat">
350 <item><ref id="open" name="open">
354 <sect1><tt/gamate.h/<label id="gamate.h"><p>
357 <!-- <item><ref id="get_tv" name="get_tv"> -->
358 <item><ref id="waitvsync" name="waitvsync">
364 <sect1><tt/geos.h/<label id="geos.h"><p>
366 <url url="geos.html" name="GEOS API">.
369 <sect1><tt/joystick.h/<label id="joystick.h"><p>
372 <item><ref id="joy_count" name="joy_count">
373 <item><ref id="joy_install" name="joy_install">
374 <item><ref id="joy_load_driver" name="joy_load_driver">
375 <item><ref id="joy_read" name="joy_read">
376 <item><ref id="joy_uninstall" name="joy_uninstall">
377 <item><ref id="joy_unload" name="joy_unload">
381 <sect1><tt/locale.h/<label id="locale.h"><p>
384 <item><ref id="localeconv" name="localeconv">
385 <item><ref id="setlocale" name="setlocale">
389 <sect1><tt/lynx.h/<label id="lynx.h"><p>
392 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
393 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
394 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
395 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
396 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
397 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
398 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
404 <sect1><tt/lz4.h/<label id="lz4.h"><p>
407 <item><ref id="decompress_lz4" name="decompress_lz4">
411 <sect1><tt/modload.h/<label id="modload.h"><p>
414 <item><ref id="mod_load" name="mod_load">
415 <item><ref id="mod_free" name="mod_free">
419 <sect1><tt/mouse.h/<label id="mouse.h"><p>
422 <item><ref id="mouse_buttons" name="mouse_buttons">
423 <item><ref id="mouse_getbox" name="mouse_getbox">
424 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
425 <item><ref id="mouse_hide" name="mouse_hide">
426 <item><ref id="mouse_info" name="mouse_info">
427 <item><ref id="mouse_install" name="mouse_install">
428 <item><ref id="mouse_ioctl" name="mouse_ioctl">
429 <item><ref id="mouse_load_driver" name="mouse_load_driver">
430 <item><ref id="mouse_move" name="mouse_move">
431 <item><ref id="mouse_pos" name="mouse_pos">
432 <item><ref id="mouse_setbox" name="mouse_setbox">
433 <item><ref id="mouse_show" name="mouse_show">
434 <item><ref id="mouse_uninstall" name="mouse_uninstall">
435 <item><ref id="mouse_unload" name="mouse_unload">
439 <sect1><tt/nes.h/<label id="nes.h"><p>
442 <!-- <item><ref id="get_tv" name="get_tv"> -->
443 <item><ref id="waitvsync" name="waitvsync">
449 <sect1><tt/o65.h/<label id="o65.h"><p>
451 The <tt/o65.h/ header file contains structure and constant definitions that
452 may be used when dealing with files in <url
453 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
454 It does not declare any functions.
457 <sect1><tt/pce.h/<label id="pce.h"><p>
460 <!-- <item><ref id="get_tv" name="get_tv"> -->
461 <item><ref id="waitvsync" name="waitvsync">
467 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
470 <item><ref id="PEEK" name="PEEK">
471 <item><ref id="PEEKW" name="PEEKW">
472 <item><ref id="POKE" name="POKE">
473 <item><ref id="POKEW" name="POKEW">
477 <sect1><tt/pen.h/<label id="pen.h"><p>
480 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
481 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
487 <sect1><tt/pet.h/<label id="pet.h"><p>
492 <sect1><tt/plus4.h/<label id="plus4.h"><p>
497 <sect1><tt/serial.h/<label id="serial.h"><p>
499 The <tt/serial.h/ header file contains definitions for initializing serial
503 <item><ref id="ser_close" name="ser_close">
504 <item><ref id="ser_get" name="ser_get">
505 <item><ref id="ser_install" name="ser_install">
506 <item><ref id="ser_ioctl" name="ser_ioctl">
507 <item><ref id="ser_load_driver" name="ser_load_driver">
508 <item><ref id="ser_open" name="ser_open">
509 <item><ref id="ser_put" name="ser_put">
510 <item><ref id="ser_status" name="ser_status">
511 <item><ref id="ser_uninstall" name="ser_uninstall">
512 <item><ref id="ser_unload" name="ser_unload">
516 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
519 <item><ref id="setjmp" name="setjmp">
520 <item><ref id="longjmp" name="longjmp">
524 <sect1><tt/signal.h/<label id="signal.h"><p>
527 <item><ref id="raise" name="raise">
528 <item><ref id="signal" name="signal">
532 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
537 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
542 <sect1><tt/stddef.h/<label id="stddef.h"><p>
545 <item><ref id="offsetof" name="offsetof">
549 <sect1><tt/stdio.h/<label id="stdio.h"><p>
552 <item><ref id="_poserror" name="_poserror">
553 <item><ref id="clearerr" name="clearerr">
554 <!-- <item><ref id="fclose" name="fclose"> -->
555 <!-- <item><ref id="fdopen" name="fdopen"> -->
556 <item><ref id="feof" name="feof">
557 <item><ref id="ferror" name="ferror">
558 <!-- <item><ref id="fflush" name="fflush"> -->
559 <!-- <item><ref id="fgetc" name="fgetc"> -->
560 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
561 <!-- <item><ref id="fgets" name="fgets"> -->
562 <item><ref id="fileno" name="fileno">
563 <!-- <item><ref id="fopen" name="fopen"> -->
564 <!-- <item><ref id="fprintf" name="fprintf"> -->
565 <!-- <item><ref id="fputc" name="fputc"> -->
566 <!-- <item><ref id="fputs" name="fputs"> -->
567 <!-- <item><ref id="fread" name="fread"> -->
568 <!-- <item><ref id="freopen" name="freopen"> -->
569 <!-- <item><ref id="fscanf" name="fscanf"> -->
570 <!-- <item><ref id="fseek" name="fseek"> -->
571 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
572 <!-- <item><ref id="ftell" name="ftell"> -->
573 <!-- <item><ref id="fwrite" name="fwrite"> -->
574 <!-- <item><ref id="getc" name="getc"> -->
575 <!-- <item><ref id="getchar" name="getchar"> -->
576 <!-- <item><ref id="gets" name="gets"> -->
577 <!-- <item><ref id="printf" name="printf"> -->
578 <!-- <item><ref id="putc" name="putc"> -->
579 <!-- <item><ref id="putchar" name="putchar"> -->
580 <!-- <item><ref id="puts" name="puts"> -->
581 <item><ref id="rename" name="rename">
582 <item><ref id="remove" name="remove">
583 <!-- <item><ref id="rewind" name="rewind"> -->
584 <!-- <item><ref id="scanf" name="scanf"> -->
585 <!-- <item><ref id="snprintf" name="snprintf"> -->
586 <!-- <item><ref id="sprintf" name="sprintf"> -->
587 <!-- <item><ref id="sscanf" name="sscanf"> -->
588 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
589 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
590 <!-- <item><ref id="vprintf" name="vprintf"> -->
591 <!-- <item><ref id="vscanf" name="vscanf"> -->
592 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
593 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
594 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
600 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
603 <item><ref id="_heapadd" name="_heapadd">
604 <item><ref id="_heapblocksize" name="_heapblocksize">
605 <item><ref id="_heapmaxavail" name="_heapmaxavail">
606 <item><ref id="_heapmemavail" name="_heapmemavail">
607 <item><ref id="_randomize" name="_randomize">
608 <item><ref id="_swap" name="_swap">
609 <item><ref id="abort" name="abort">
610 <item><ref id="abs" name="abs">
611 <item><ref id="atexit" name="atexit">
612 <item><ref id="atoi" name="atoi">
613 <item><ref id="atol" name="atol">
614 <item><ref id="bsearch" name="bsearch">
615 <item><ref id="calloc" name="calloc">
616 <item><ref id="div" name="div">
617 <item><ref id="exit" name="exit">
618 <item><ref id="free" name="free">
619 <item><ref id="getenv" name="getenv">
620 <item><ref id="itoa" name="itoa">
621 <item><ref id="labs" name="labs">
622 <item><ref id="ltoa" name="ltoa">
623 <item><ref id="malloc" name="malloc">
624 <item><ref id="perror" name="perror">
625 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
626 <!-- <item><ref id="putenv" name="putenv"> -->
627 <item><ref id="qsort" name="qsort">
628 <item><ref id="rand" name="rand">
629 <item><ref id="realloc" name="realloc">
630 <item><ref id="srand" name="srand">
631 <!-- <item><ref id="system" name="system"> -->
632 <item><ref id="ultoa" name="ultoa">
633 <item><ref id="utoa" name="utoa">
639 <sect1><tt/string.h/<label id="string.h"><p>
642 <item><ref id="_stroserror" name="_stroserror">
643 <item><ref id="bzero" name="bzero">
644 <item><ref id="memchr" name="memchr">
645 <item><ref id="memcmp" name="memcmp">
646 <item><ref id="memcpy" name="memcpy">
647 <item><ref id="memmove" name="memmove">
648 <item><ref id="memset" name="memset">
649 <item><ref id="strcasecmp" name="strcasecmp">
650 <item><ref id="strcat" name="strcat">
651 <item><ref id="strchr" name="strchr">
652 <item><ref id="strcmp" name="strcmp">
653 <item><ref id="strcoll" name="strcoll">
654 <item><ref id="strcpy" name="strcpy">
655 <item><ref id="strcspn" name="strcspn">
656 <item><ref id="strdup" name="strdup">
657 <item><ref id="strerror" name="strerror">
658 <item><ref id="stricmp" name="stricmp">
659 <item><ref id="strlen" name="strlen">
660 <item><ref id="strlower" name="strlower">
661 <item><ref id="strlwr" name="strlwr">
662 <item><ref id="strncat" name="strncat">
663 <item><ref id="strncmp" name="strncmp">
664 <item><ref id="strncpy" name="strncpy">
665 <item><ref id="strqtok" name="strqtok">
666 <item><ref id="strrchr" name="strrchr">
667 <item><ref id="strspn" name="strspn">
668 <item><ref id="strstr" name="strstr">
669 <item><ref id="strtok" name="strtok">
670 <item><ref id="strxfrm" name="strxfrm">
671 <item><ref id="strupper" name="strupper">
672 <item><ref id="strupr" name="strupr">
678 <sect1><tt/tgi.h/<label id="tgi.h"><p>
681 <item><ref id="tgi_arc" name="tgi_arc">
682 <item><ref id="tgi_bar" name="tgi_bar">
683 <item><ref id="tgi_circle" name="tgi_circle">
684 <item><ref id="tgi_clear" name="tgi_clear">
685 <item><ref id="tgi_done" name="tgi_done">
686 <item><ref id="tgi_ellipse" name="tgi_ellipse">
687 <item><ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
688 <item><ref id="tgi_getaspectratio" name="tgi_getaspectratio">
689 <item><ref id="tgi_getcolor" name="tgi_getcolor">
690 <item><ref id="tgi_getcolorcount" name="tgi_getcolorcount">
691 <item><ref id="tgi_getdefpalette" name="tgi_getdefpalette">
692 <item><ref id="tgi_geterror" name="tgi_geterror">
693 <item><ref id="tgi_geterrormsg" name="tgi_geterrormsg">
694 <item><ref id="tgi_getmaxcolor" name="tgi_getmaxcolor">
695 <item><ref id="tgi_getmaxx" name="tgi_getmaxx">
696 <item><ref id="tgi_getmaxy" name="tgi_getmaxy">
697 <item><ref id="tgi_getpagecount" name="tgi_getpagecount">
698 <item><ref id="tgi_getpalette" name="tgi_getpalette">
699 <item><ref id="tgi_getpixel" name="tgi_getpixel">
700 <item><ref id="tgi_gettextheight" name="tgi_gettextheight">
701 <item><ref id="tgi_gettextwidth" name="tgi_gettextwidth">
702 <item><ref id="tgi_getxres" name="tgi_getxres">
703 <item><ref id="tgi_getyres" name="tgi_getyres">
704 <item><ref id="tgi_gotoxy" name="tgi_gotoxy">
705 <item><ref id="tgi_init" name="tgi_init">
706 <item><ref id="tgi_install" name="tgi_install">
707 <item><ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
708 <item><ref id="tgi_ioctl" name="tgi_ioctl">
709 <item><ref id="tgi_line" name="tgi_line">
710 <item><ref id="tgi_lineto" name="tgi_lineto">
711 <item><ref id="tgi_load_driver" name="tgi_load_driver">
712 <item><ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">
713 <item><ref id="tgi_outtext" name="tgi_outtext">
714 <item><ref id="tgi_outtextxy" name="tgi_outtextxy">
715 <item><ref id="tgi_setaspectratio" name="tgi_setaspectratio">
716 <item><ref id="tgi_setcolor" name="tgi_setcolor">
717 <item><ref id="tgi_setdrawpage" name="tgi_setdrawpage">
718 <item><ref id="tgi_setpalette" name="tgi_setpalette">
719 <item><ref id="tgi_setpixel" name="tgi_setpixel">
720 <item><ref id="tgi_setviewpage" name="tgi_setviewpage">
721 <item><ref id="tgi_settextscale" name="tgi_settextscale">
722 <item><ref id="tgi_settextstyle" name="tgi_settextstyle">
723 <item><ref id="tgi_uninstall" name="tgi_uninstall">
724 <item><ref id="tgi_unload" name="tgi_unload">
727 <sect1><tt/time.h/<label id="time.h"><p>
730 <!-- <item><ref id="_systime" name="_systime"> -->
731 <!-- <item><ref id="asctime" name="asctime"> -->
732 <item><ref id="clock" name="clock">
733 <!-- <item><ref id="ctime" name="ctime"> -->
734 <!-- <item><ref id="gmtime" name="gmtime"> -->
735 <!-- <item><ref id="localtime" name="localtime"> -->
736 <!-- <item><ref id="mktime" name="mktime"> -->
737 <!-- <item><ref id="strftime" name="strftime"> -->
738 <item><ref id="time" name="time">
744 <sect1><tt/unistd.h/<label id="unistd.h"><p>
747 <!-- <item><ref id="chdir" name="chdir"> -->
748 <item><ref id="exec" name="exec">
749 <!-- <item><ref id="getcwd" name="getcwd"> -->
750 <item><ref id="getopt" name="getopt">
751 <!-- <item><ref id="lseek" name="lseek"> -->
752 <!-- <item><ref id="mkdir" name="mkdir"> -->
753 <!-- <item><ref id="read" name="read"> -->
754 <!-- <item><ref id="rmdir" name="rmdir"> -->
755 <item><ref id="sleep" name="sleep">
756 <item><ref id="unlink" name="unlink">
757 <!-- <item><ref id="write" name="write"> -->
763 <sect1><tt/vic20.h/<label id="vic20.h"><p>
768 <sect1><tt/zlib.h/<label id="zlib.h"><p>
771 <!-- <item><ref id="adler32" name="adler32"> -->
772 <!-- <item><ref id="crc32" name="crc32"> -->
773 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
774 <!-- <item><ref id="uncompress" name="uncompress"> -->
780 <sect>Alphabetical function reference<p>
782 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
786 <tag/Function/Determine if a directory entry specifies a directory.
787 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
788 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
789 <tag/Description/The function is called with the type of a directory entry
790 taken from a <tt/struct dirent/ and returns true if the entry designates
793 <item>The function is actually a macro.
795 <tag/Availability/cc65
797 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
798 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
799 <ref id="_DE_ISREG" name="_DE_ISREG">
805 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
809 <tag/Function/Determine if a directory entry specifies a disk label.
810 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
811 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
812 <tag/Description/The function is called with the type of a directory entry
813 taken from a <tt/struct dirent/ and returns true if the entry designates
816 <item>The function is actually a macro.
818 <tag/Availability/cc65
820 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
821 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
822 <ref id="_DE_ISREG" name="_DE_ISREG">
828 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
832 <tag/Function/Determine if a directory entry specifies a link.
833 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
834 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
835 <tag/Description/The function is called with the type of a directory entry
836 taken from a <tt/struct dirent/ and returns true if the entry designates
839 <item>The function is actually a macro.
841 <tag/Availability/cc65
843 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
844 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
845 <ref id="_DE_ISREG" name="_DE_ISREG">
851 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
855 <tag/Function/Determine if a directory entry specifies a regular file.
856 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
857 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
858 <tag/Description/The function is called with the type of a directory entry
859 taken from a <tt/struct dirent/ and returns true if the entry designates
862 <item>The function is actually a macro.
863 <item>A "regular file" means anything with data in it. This might still mean
864 that special processing is needed, when accessing the file. Relative files of
865 the CBM systems are classified as being "regular" files, for example.
867 <tag/Availability/cc65
869 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
870 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
871 <ref id="_DE_ISLNK" name="_DE_ISLNK">
877 <sect1>_heapadd<label id="_heapadd"><p>
881 <tag/Function/Add a block to the heap.
882 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
883 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
884 <tag/Description/The function adds a block of raw memory to the heap.
886 <item>The minimum blocksize that can be added is 6 bytes; the function will
887 ignore smaller blocks.
888 <item>The function is available only as a fastcall function; so, it may be used
889 only in the presence of a prototype.
891 <tag/Availability/cc65
893 <ref id="_heapblocksize" name="_heapblocksize">,
894 <ref id="_heapmaxavail" name="_heapmaxavail">,
895 <ref id="_heapmemavail" name="_heapmemavail">,
896 <ref id="calloc" name="calloc">,
897 <ref id="free" name="free">,
898 <ref id="malloc" name="malloc">,
899 <ref id="realloc" name="realloc">
905 <sect1>_heapblocksize<label id="_heapblocksize"><p>
909 <tag/Function/Return the size of an allocated block.
910 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
911 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
912 <tag/Description/The function returns the size of a block that must have
913 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
914 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
916 <item>Passing a pointer to a block that was is not the result of one of the
917 allocation functions, or that has been free'd will give unpredicable results.
918 <item>The function is available only as a fastcall function; so, it may be used
919 only in the presence of a prototype.
921 <tag/Availability/cc65
923 <ref id="_heapadd" name="_heapadd">,
924 <ref id="_heapmaxavail" name="_heapmaxavail">,
925 <ref id="_heapmemavail" name="_heapmemavail">,
926 <ref id="calloc" name="calloc">,
927 <ref id="free" name="free">,
928 <ref id="malloc" name="malloc">,
929 <ref id="realloc" name="realloc">
935 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
939 <tag/Function/Return the largest block that is available on the heap.
940 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
941 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
942 <tag/Description/The function returns the size of the largest block that may
943 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
944 <tag/Availability/cc65
946 <ref id="_heapadd" name="_heapadd">,
947 <ref id="_heapblocksize" name="_heapblocksize">,
948 <ref id="_heapmemavail" name="_heapmemavail">,
949 <ref id="calloc" name="calloc">,
950 <ref id="free" name="free">,
951 <ref id="malloc" name="malloc">,
952 <ref id="realloc" name="realloc">
958 <sect1>_heapmemavail<label id="_heapmemavail"><p>
962 <tag/Function/Return the total available space on the heap.
963 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
964 <tag/Declaration/<tt/size_t _heapmemavail (void);/
965 <tag/Description/The function returns the total number of bytes available on
968 <item>This function is of less use than usually assumed, since the returned
969 heap space may be available but not in one block. So even if this function
970 says that several times more heap space is available than needed, <ref
971 id="malloc" name="malloc"> may still return <tt/NULL/.
973 <tag/Availability/cc65
975 <ref id="_heapadd" name="_heapadd">,
976 <ref id="_heapblocksize" name="_heapblocksize">,
977 <ref id="_heapmaxavail" name="_heapmaxavail">,
978 <ref id="calloc" name="calloc">,
979 <ref id="free" name="free">,
980 <ref id="malloc" name="malloc">,
981 <ref id="realloc" name="realloc">
987 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
991 <tag/Function/Determines whether the underlying DOS supports command line arguments.
992 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
993 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
994 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
995 It returns 1 if it does.
996 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1001 <sect1>_poserror<label id="_poserror"><p>
1005 <tag/Function/Print an error message for the error in <tt/_oserror/.
1006 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1007 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1008 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1009 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1010 a colon and a blank. Then the error message for the current contents of
1011 <tt/_oserror/ are printed followed by a newline. The message output is the
1012 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1013 argument of <tt/_oserror/.
1014 <tag/Notes/<itemize>
1015 <item>Since operating system specific error code are - you guessed it -
1016 operating system specific, the value in <tt/_oserror/ and the message that is
1017 printed depends on the cc65 target.
1018 <item>The function is only available as fastcall function, so it may only
1019 be used in presence of a prototype.
1021 <tag/Availability/cc65
1023 <ref id="_stroserror" name="_stroserror">,
1024 <ref id="perror" name="perror">
1030 <sect1>_randomize<label id="_randomize"><p>
1034 <tag/Function/Initialize the pseudo random number generator.
1035 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1036 <tag/Declaration/<tt/void _randomize (void);/
1037 <tag/Description/The function initializes the random number generator with
1038 a seed derived from fast changing hardware events, so the seed itself can be
1039 considered random to a certain degree.
1040 <tag/Notes/<itemize>
1041 <item>The randomness of the seed depends on the machine hardware.
1043 <tag/Availability/cc65
1045 <ref id="rand" name="rand">,
1046 <ref id="srand" name="srand">
1052 <sect1>_stroserror<label id="_stroserror"><p>
1056 <tag/Function/Return a string describing an OS specific error code.
1057 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1058 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1059 <tag/Description/<tt/_stroserror/ will return a string describing the given
1060 operating system specific error code.
1061 <tag/Notes/<itemize>
1062 <item>Since operating system specific error code are - you guessed it -
1063 operating system specific, the parameter and the string returned depend on the
1065 <item>The function is only available as fastcall function, so it may only be
1066 used in presence of a prototype.
1068 <tag/Availability/cc65
1070 <ref id="strerror" name="strerror">
1076 <sect1>_swap<label id="_swap"><p>
1080 <tag/Function/Swap the contents of memory areas.
1081 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1082 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1083 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1084 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1085 <tt/size/ bytes in size.
1086 <tag/Notes/<itemize>
1087 <item>The memory areas may not overlap, otherwise the results are undefined.
1088 <item>The function is only available as fastcall function, so it may only be
1089 used in presence of a prototype.
1091 <tag/Availability/cc65
1093 <ref id="memcpy" name="memcpy">,
1094 <ref id="memmove" name="memmove">
1100 <sect1>_sys<label id="_sys"><p>
1104 <tag/Function/Call a subroutine passing register values.
1105 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1106 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1107 <tag/Description/The function will call the subroutine at the address
1108 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1109 registers and the CPU flags are set to the values given in the <tt/regs/
1110 structure. On return from the subroutine, the new values of the registers and
1111 flags are stored back overwriting the old values.
1112 <tag/Notes/<itemize>
1113 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1114 when calling the subroutine (they are unchanged from their current values).
1115 <item>The function is only available as fastcall function, so it may only be
1116 used in presence of a prototype.
1118 <tag/Availability/cc65
1124 <sect1>BRK<label id="BRK"><p>
1128 <tag/Function/Insert a 6502 BRK instrunction into the code.
1129 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1130 <tag/Declaration/<tt/void BRK (void);/
1131 <tag/Description/The function will insert a 6502 BRK instruction into the code
1132 which may be used to trigger a debugger.
1133 <tag/Notes/<itemize>
1134 <item>The function is actually a macro.
1135 <item>The inserted instruction may lead to unexpected results if no debugger
1138 <tag/Availability/cc65
1140 <ref id="CLI" name="CLI">,
1141 <ref id="SEI" name="SEI">
1147 <sect1>CLI<label id="CLI"><p>
1151 <tag/Function/Insert a 6502 CLI instrunction into the code.
1152 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1153 <tag/Declaration/<tt/void CLI (void);/
1154 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1155 so interrupts are enabled. Enabling interrupts has no effects if they are
1156 already enabled (the default).
1157 <tag/Notes/<itemize>
1158 <item>The function is actually a macro.
1159 <item>Disabling interrupts may lead to unexpected results.
1161 <tag/Availability/cc65
1163 <ref id="BRK" name="BRK">,
1164 <ref id="SEI" name="SEI">
1170 <sect1>PEEK<label id="PEEK"><p>
1174 <tag/Function/Read a byte from memory.
1175 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1176 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1177 <tag/Description/The function will read the absolute memory given by <tt/addr/
1178 and return the value read.
1179 <tag/Notes/<itemize>
1180 <item>The function is actually a macro.
1181 <item>This function depends highly on the platform and environment.
1183 <tag/Availability/cc65
1185 <ref id="PEEKW" name="PEEKW">,
1186 <ref id="POKE" name="POKE">
1192 <sect1>PEEKW<label id="PEEKW"><p>
1196 <tag/Function/Read a word (two bytes) from memory.
1197 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1198 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1199 <tag/Description/The function will read the absolute memory given by <tt/addr/
1200 and return the value read. The byte read from the higher address is the high
1201 byte of the return value.
1202 <tag/Notes/<itemize>
1203 <item>The function is actually a macro.
1204 <item>This function depends highly on the platform and environment.
1205 <item>The order in which the two bytes are read is unspecified and may
1206 depend of the address expression used.
1208 <tag/Availability/cc65
1210 <ref id="PEEK" name="PEEK">,
1211 <ref id="POKE" name="POKE">
1217 <sect1>POKE<label id="POKE"><p>
1221 <tag/Function/Write a byte to memory.
1222 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1223 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1224 <tag/Description/The function writes the value <tt/val/ to the absolute
1225 memory address given by <tt/addr/.
1226 <tag/Notes/<itemize>
1227 <item>The function is actually a macro.
1228 <item>This function depends highly on the platform and environment.
1229 <item>Careless use will cause the program to act strange or may crash the
1232 <tag/Availability/cc65
1234 <ref id="PEEK" name="PEEK">,
1235 <ref id="POKEW" name="POKEW">
1241 <sect1>POKEW<label id="POKEW"><p>
1245 <tag/Function/Write a word (two bytes) to memory.
1246 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1247 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1248 <tag/Description/The function writes the value <tt/val/ to the absolute
1249 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1250 the <tt/addr/, the high byte is written to <tt/addr+1/.
1251 <tag/Notes/<itemize>
1252 <item>The function is actually a macro.
1253 <item>This function depends highly on the platform and environment.
1254 <item>Careless use will cause the program to act strange or may crash the
1256 <item>The order in which the two bytes are written is unspecified and may
1257 depend of the address expression used.
1259 <tag/Availability/cc65
1261 <ref id="PEEK" name="PEEK">,
1262 <ref id="POKE" name="POKE">
1268 <sect1>SEI<label id="SEI"><p>
1272 <tag/Function/Insert a 6502 SEI instrunction into the code.
1273 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1274 <tag/Declaration/<tt/void SEI (void);/
1275 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1276 so interrupts are disabled. Note that non maskable interrupts cannot be
1278 <tag/Notes/<itemize>
1279 <item>The function is actually a macro.
1280 <item>Disabling interrupts may lead to unexpected results.
1282 <tag/Availability/cc65
1284 <ref id="BRK" name="BRK">,
1285 <ref id="CLI" name="CLI">
1291 <sect1>abort<label id="abort"><p>
1295 <tag/Function/Terminates a program abnormally.
1296 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1297 <tag/Declaration/<tt/void abort (void);/
1298 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1299 on stderr, then terminates the program with an exit code of 3.
1300 <tag/Availability/ISO 9899
1302 <ref id="assert" name="assert">,
1303 <ref id="exit" name="exit">,
1304 <ref id="raise" name="raise">
1310 <sect1>abs<label id="abs"><p>
1314 <tag/Function/Returns the absolute value of an integer.
1315 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1316 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1317 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1319 <tag/Notes/<itemize>
1320 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1321 <item>The function is only available as fastcall function, so it may only be
1322 used in presence of a prototype.
1324 <tag/Availability/ISO 9899
1326 <ref id="labs" name="labs">
1332 <sect1>assert<label id="assert"><p>
1336 <tag/Function/Test a condition and possibly abort.
1337 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1338 <tag/Declaration/<tt/void assert (int cond);/
1339 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1340 statement. If the condition evaluates t zero (false), assert prints a message
1341 on stderr and aborts the program.
1342 <tag/Notes/<itemize>
1343 <item>The function is actually a macro.
1345 <tag/Availability/ISO 9899
1347 <ref id="abort" name="abort">,
1348 <ref id="exit" name="exit">
1354 <sect1>atexit<label id="atexit"><p>
1358 <tag/Function/Register an exit function.
1359 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1360 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1361 <tag/Description/<tt/atexit/ registers the function pointed to by
1362 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1363 terminates, they are called in LIFO order (the last function registered is
1364 called first). <tt/atexit/ returns zero on success and a nonzero value on
1366 <tag/Notes/<itemize>
1367 <item>A maximum of 5 exit functions can be registered.
1368 <item>There is no way to unregister an exit function.
1369 <item>The function is only available as fastcall function, so it may only be
1370 used in presence of a prototype.
1372 <tag/Availability/ISO 9899
1374 <ref id="abort" name="abort">,
1375 <ref id="exit" name="exit">
1381 <sect1>atmos_load<label id="atmos_load"><p>
1385 <tag/Function/Load Atmos tape.
1386 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1387 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1388 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1389 <tag/Notes/<itemize>
1390 <item>The function is available only as a fastcall function; so, it may be used
1391 only in the presence of a prototype.
1393 <tag/Availability/cc65
1395 <ref id="atmos_save" name="atmos_save">
1401 <sect1>atmos_save<label id="atmos_save"><p>
1405 <tag/Function/Save Atmos tape.
1406 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1407 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1408 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1409 <tag/Notes/<itemize>
1410 <item>The function is available only as a fastcall function; so, it may be used
1411 only in the presence of a prototype.
1413 <tag/Availability/cc65
1415 <ref id="atmos_load" name="atmos_load">
1417 atmos_save("hires", 0xa000, 0xc000);
1423 <sect1>atoi<label id="atoi"><p>
1427 <tag/Function/Convert a string to an integer.
1428 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1429 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1430 <tag/Description/<tt/atoi/ converts the given string into an integer.
1431 Conversion stops as soon as any invalid character is encountered.
1432 <tag/Notes/<itemize>
1433 <item>There is no way to detect any conversion errors.
1434 <item>The function does not check for an numerical overflow when converting.
1435 <item>The function is only available as fastcall function, so it may only be
1436 used in presence of a prototype.
1438 <tag/Availability/ISO 9899
1440 <ref id="atol" name="atol">,
1441 <ref id="itoa" name="itoa">,
1442 <ref id="ltoa" name="ltoa">,
1443 <ref id="ultoa" name="ultoa">,
1444 <ref id="utoa" name="utoa">
1450 <sect1>atol<label id="atol"><p>
1454 <tag/Function/Convert a string to a long integer.
1455 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1456 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1457 <tag/Description/<tt/atol/ converts the given string into a long integer.
1458 Conversion stops as soon as any invalid character is encountered.
1459 <tag/Notes/<itemize>
1460 <item>There is no way to detect any conversion errors.
1461 <item>The function does not check for an numerical overflow when converting.
1462 <item>The function is only available as fastcall function, so it may only be
1463 used in presence of a prototype.
1465 <tag/Availability/ISO 9899
1467 <ref id="atoi" name="atoi">,
1468 <ref id="itoa" name="itoa">,
1469 <ref id="ltoa" name="ltoa">,
1470 <ref id="ultoa" name="ultoa">,
1471 <ref id="utoa" name="utoa">
1477 <sect1>bgcolor<label id="bgcolor"><p>
1481 <tag/Function/Set the background text color.
1482 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1483 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1484 <tag/Description/The function will set a new background color and return the
1485 old (current) one. The background color is valid for the whole text output
1486 area of the screen, not just for new text.
1487 <tag/Notes/<itemize>
1488 <item>Background colors are system dependent. The function may have no effect
1489 on systems where the background color cannot be changed.
1490 <item>The function is only available as fastcall function, so it may only be
1491 used in presence of a prototype.
1493 <tag/Availability/cc65
1495 <ref id="bordercolor" name="bordercolor">,
1496 <ref id="textcolor" name="textcolor">
1502 <sect1>bordercolor<label id="bordercolor"><p>
1506 <tag/Function/Set the border (frame) color.
1507 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1508 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1509 <tag/Description/The function will set a new border color. It returns the old
1510 (current) border color.
1511 <tag/Notes/<itemize>
1512 <item>Border colors are system dependent. The function may have no effect
1513 on systems where the border color cannot be changed.
1514 <item>The function is only available as fastcall function, so it may only
1515 be used in presence of a prototype.
1517 <tag/Availability/cc65
1519 <ref id="bgcolor" name="bgcolor">,
1520 <ref id="textcolor" name="textcolor">
1526 <sect1>bsearch<label id="bsearch"><p>
1530 <tag/Function/Do a binary search in a sorted array.
1531 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1532 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1533 const void* base, size_t n, size_t size,
1534 int __fastcall__ (* cmp) (const void*, const void*));/
1535 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1536 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1537 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1538 the function used to compare the members against the key. The function returns
1539 a pointer to the member found, or <tt/NULL/ if there was no match.
1540 <tag/Notes/<itemize>
1541 <item>The contents of the array must be sorted in ascending order according to
1542 the compare function given.
1543 <item>If there are multiple members that match the key, the function will
1544 return one of the members.
1545 <item>The function is only available as fastcall function, so it may only
1546 be used in presence of a prototype.
1547 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1550 <tag/Availability/ISO 9899
1552 <ref id="qsort" name="qsort">
1558 <sect1>bzero<label id="bzero"><p>
1562 <tag/Function/Fill a memory area with zeroes.
1563 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1564 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1565 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1567 <tag/Notes/<itemize>
1568 <item>The function is non standard and therefore only available in non ANSI
1569 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1570 <item>The function is only available as fastcall function, so it may only
1571 be used in presence of a prototype.
1573 <tag/Availability/cc65
1575 <ref id="_swap" name="_swap">,
1576 <ref id="memcpy" name="memcpy">,
1577 <ref id="memmove" name="memmove">,
1578 <ref id="memset" name="memset">,
1584 <sect1>c64mode<label id="c64mode"><p>
1588 <tag/Function/Switch the C128 into C64 compatible mode.
1589 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1590 <tag/Declaration/<tt/void c64mode (void);/
1591 <tag/Description/The function will cause the machine to reboot into C64 mode.
1592 <tag/Notes/<itemize>
1593 <item>The function is specific to the C128.
1594 <item>The function will not return to the caller.
1596 <tag/Availability/C128
1602 <sect1>calloc<label id="calloc"><p>
1606 <tag/Function/Allocate and clear memory.
1607 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1608 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1609 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1610 of size <tt/size/, clears the whole block with binary zeroes and returns a
1611 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1613 <tag/Notes/<itemize>
1614 <item>Clearing the memory may not have the expected effect on all platforms:
1615 pointers in the block may not be <tt/NULL/ and floating point variables may
1616 not be zero (0.0). In other words: The "clearing" effect of this function
1617 should be used with care for portable programs.
1618 <item>The function is only available as fastcall function, so it may only
1619 be used in presence of a prototype.
1621 <tag/Availability/ISO 9899
1623 <ref id="_heapadd" name="_heapadd">,
1624 <ref id="_heapblocksize" name="_heapblocksize">,
1625 <ref id="_heapmaxavail" name="_heapmaxavail">,
1626 <ref id="_heapmemavail" name="_heapmemavail">,
1627 <ref id="free" name="free">,
1628 <ref id="malloc" name="malloc">,
1629 <ref id="realloc" name="realloc">
1635 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1639 <tag/Function/Input byte from serial bus
1640 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1641 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1642 <tag/Description/The function returns a byte of data, which it
1643 gets from the current TALKer on the serial bus.
1644 In order to receive the data, the device must have previously been
1645 sent a command to TALK and a secondary address if it needs one.
1646 <tag/Notes/<itemize>
1649 <tag/Availability/cc65
1651 <ref id="cbm_k_talk" name="cbm_k_talk">,
1657 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1661 <tag/Function/Input a Character from the Current Device
1662 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1663 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1664 <tag/Description/The function returns a character from the current input device.
1665 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1666 When this function is called, the next byte of data available from the device is returned.
1667 Exception is the routine for the keyboard device (which is the default input device).
1668 <tag/Notes/<itemize>
1671 <tag/Availability/cc65
1673 <ref id="cbm_k_open" name="cbm_k_open">,
1674 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1680 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1684 <tag/Function/Output a byte
1685 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1686 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1687 <tag/Description/Function sends the character to the current output device.
1688 Unless a device has been OPENed and designated as the
1689 current output channel using the CHKOUT routine, the character is
1690 printed to the screen, which is the default output device. If the
1691 cassette is the current device, outputting a byte will only add it to
1692 the buffer. No actual transmission of data will occur until the
1693 192-byte buffer is full.
1694 <tag/Notes/<itemize>
1695 <item>The function is only available as fastcall function, so it may
1696 only be used in presence of a prototype.
1698 <tag/Availability/cc65
1700 <ref id="cbm_k_open" name="cbm_k_open">,
1701 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1707 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1711 <tag/Function/Designate a Logical File As the Current Input Channel
1712 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1713 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1714 <tag/Description/If you wish to
1715 get data from any device other than the keyboard, this function must be
1716 called after OPENing the device, before you can get a data byte with
1717 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1718 the logical file whose file number was supplied as the
1719 current file, its device as the current device, and its secondary
1720 address as the current secondary address. If the device on the
1721 channel is a serial device, which requires a TALK command and
1722 sometimes a secondary address, function will send them over the
1724 <tag/Notes/<itemize>
1725 <item>The function is only available as fastcall function, so it may
1726 only be used in presence of a prototype.
1728 <tag/Availability/cc65
1730 <ref id="cbm_k_open" name="cbm_k_open">,
1731 <ref id="cbm_k_basin" name="cbm_k_basin">,
1732 <ref id="cbm_k_getin" name="cbm_k_getin">
1738 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1742 <tag/Function/Transmit a byte over the serial bus
1743 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1744 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1745 <tag/Description/Purpose of this function is to send a byte of data over
1746 the serial bus. In order for the data to be received, the serial
1747 device must have first been commanded to LISTEN and been given a
1748 secondary address if necessary. This routine always buffers the
1749 current character, and defers sending it until the next byte is
1750 buffered. When the UNLISTEN command is sent, the last byte will be
1751 sent with an End or Identify (EOI).
1752 <tag/Notes/<itemize>
1753 <item>The function is only available as fastcall function, so it may
1754 only be used in presence of a prototype.
1756 <tag/Availability/cc65
1758 <ref id="cbm_k_listen" name="cbm_k_listen">,
1759 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1765 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1769 <tag/Function/Designate a Logical File As the Current Output Channel
1770 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1771 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1772 <tag/Description/If you wish to
1773 output data to any device other than the screen, this routine must be
1774 called after OPENing the device, and before you output a data byte
1775 with the cbm_k_bsout() function. When called, the function will designate the
1776 logical file whose file number was supplied as the current
1777 file, its device as the current device, and its secondary address as
1778 the current secondary address. If the device on the channel uses the
1779 serial bus, and therefore requires a LISTEN command and possibly a
1780 secondary address, this information will be sent on the bus.
1781 <tag/Notes/<itemize>
1782 <item>The function is only available as fastcall function, so it may
1783 only be used in presence of a prototype.
1785 <tag/Availability/cc65
1787 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1788 <ref id="cbm_k_listen" name="cbm_k_listen">
1794 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1798 <tag/Function/Close All Logical I/O Files
1799 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1800 <tag/Declaration/<tt/void cbm_k_clall (void);/
1801 <tag/Description/It closes all
1802 open files, by resetting the index into open files to
1803 zero and restores the default I/O devices.
1804 <tag/Notes/<itemize>
1807 <tag/Availability/cc65
1809 <ref id="cbm_k_open" name="cbm_k_open">,
1810 <ref id="cbm_k_close" name="cbm_k_close">
1816 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1820 <tag/Function/Close a Logical I/O File
1821 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1822 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1823 <tag/Description/It is used to
1824 close a logical file after all I/O operations involving that file have
1826 <tag/Notes/<itemize>
1827 <item>The function is only available as fastcall function, so it may
1828 only be used in presence of a prototype.
1830 <tag/Availability/cc65
1832 <ref id="cbm_k_open" name="cbm_k_open">,
1833 <ref id="cbm_k_clall" name="cbm_k_clall">
1839 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1843 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1844 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1845 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1846 <tag/Description/It sets the
1847 current input device to the keyboard, and the current output device to
1848 the screen. Also, if the current input device was formerly a serial
1849 device, the routine sends it an UNTALK command on the serial bus, and
1850 if a serial device was formerly the current output device, the routine
1851 sends it an UNLISTEN command.
1852 <tag/Notes/<itemize>
1855 <tag/Availability/cc65
1857 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
1858 <ref id="cbm_k_ckout" name="cbm_k_ckout">
1864 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
1868 <tag/Function/Get One Byte from the Input Device
1869 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1870 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
1871 <tag/Description/Function gets a character from the current input device.
1872 <tag/Notes/<itemize>
1875 <tag/Availability/cc65
1877 <ref id="cbm_k_basin" name="cbm_k_basin">
1883 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
1887 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
1888 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1889 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
1890 <tag/Description/This function returns the address of
1891 the memory section where the memory mapped I/O devices are located. This
1892 address can then be used with an offset to access the memory mapped I/O
1893 devices in the Commodore 64. The offset is the number of locations from
1894 the beginning of the page on which the I/O register you want is located.
1895 This function exists to provide compatibility between the Commodore 64,
1896 VIC-20, and future models of the Commodore 64. If the I/O locations for
1897 a program are set by a call to this function, they should
1898 still remain compatible with future versions of the Commodore 64, the
1900 <tag/Notes/<itemize>
1903 <tag/Availability/cc65
1911 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
1915 <tag/Function/Command a device on the serial bus to LISTEN
1916 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1917 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
1918 <tag/Description/This function will command a device on the serial bus to
1919 receive data. The KERNAL routine will OR the supplied device number bit by bit
1920 to convert it to a listen address, then transmits this data as a command on
1921 the serial bus. The specified device will then go into listen mode, and
1922 be ready to accept information.
1923 <tag/Notes/<itemize>
1924 <item>The function is only available as fastcall function, so it may
1925 only be used in presence of a prototype.
1927 <tag/Availability/cc65
1929 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
1935 <sect1>cbm_k_load<label id="cbm_k_load"><p>
1939 <tag/Function/Load RAM from a Device
1940 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1941 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
1942 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
1943 It can also be used for a verify operation, comparing data from a device with the data already in
1944 memory, while leaving the data stored in RAM unchanged.
1945 The flag must be set to 0 for a LOAD operation, or 1 for a
1946 verify, If the input device is OPENed with a secondary address (SA) of 0
1947 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
1948 If the device is addressed with a secondary address of 1, then the data is
1949 loaded into memory starting at the location specified by the header.
1950 Function returns the address of the highest RAM location loaded.
1951 Before this function can be called, the KERNAL SETLFS, and SETNAM
1952 routines must be called.
1953 <tag/Notes/<itemize>
1954 <item>The function is only available as fastcall function, so it may
1955 only be used in presence of a prototype.
1957 <tag/Availability/cc65
1959 <ref id="cbm_k_save" name="cbm_k_save">,
1960 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1961 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1967 <sect1>cbm_k_open<label id="cbm_k_open"><p>
1971 <tag/Function/Open a Logical I/O File
1972 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1973 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
1974 <tag/Description/This function assigns a logical file to a device, so that it can be used for
1975 Input/Output operations. In order to specify the logical file number,
1976 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
1977 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
1978 functions are called, cbm_k_open() is then called.
1979 <tag/Notes/<itemize>
1982 <tag/Availability/cc65
1984 <ref id="cbm_k_close" name="cbm_k_close">,
1985 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1986 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1992 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
1996 <tag/Function/Read status word
1997 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1998 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
1999 <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.
2000 <tag/Notes/<itemize>
2003 <tag/Availability/cc65
2011 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2015 <tag/Function/Save RAM to a Device
2016 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2017 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2018 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2019 used before calling this function. However, a file name is not required to
2020 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2021 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.
2022 <tag/Notes/<itemize>
2023 <item>The function is only available as fastcall function, so it may
2024 only be used in presence of a prototype.
2026 <tag/Availability/cc65
2028 <ref id="cbm_k_load" name="cbm_k_load">,
2029 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2030 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2036 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2040 <tag/Function/Scan the keyboard matrix.
2041 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2042 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2043 <tag/Description/This function looks at the switches in the keyboard, to see
2044 if any of them are being pressed. If they are, then code numbers for them are
2045 stored in RAM. Other functions use those numbers to input text. Normally,
2046 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2047 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2048 function, in order to provide input from the keyboard.
2049 <tag/Availability/cc65
2051 <ref id="cbm_k_getin" name="cbm_k_getin">,
2052 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2053 <ref id="cgetc" name="cgetc">,
2054 <!-- <ref id="getc" name="getc"> -->
2055 <!-- <ref id="getchar" name="getchar"> -->
2061 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2065 <tag/Function/Set up a logical file
2066 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2067 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2068 <tag/Description/This functions sets up the logical file by setting its number, device address,
2069 and secondary address.
2070 <tag/Notes/<itemize>
2071 <item>The function is only available as fastcall function, so it may
2072 only be used in presence of a prototype.
2074 <tag/Availability/cc65
2076 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2082 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2086 <tag/Function/Set Filename Parameters
2087 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2088 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2089 <tag/Description/This function is used to set up the file name for the OPEN,
2090 SAVE, or LOAD operations.
2091 <tag/Notes/<itemize>
2092 <item>The function is only available as fastcall function, so it may
2093 only be used in presence of a prototype.
2095 <tag/Availability/cc65
2097 <ref id="cbm_k_open" name="cbm_k_open">,
2098 <ref id="cbm_k_load" name="cbm_k_load">,
2099 <ref id="cbm_k_save" name="cbm_k_save">
2105 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2109 <tag/Function/Commands device to TALK
2110 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2111 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2112 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2113 bus. This commands the device to TALK.
2114 <tag/Notes/<itemize>
2115 <item>The function is only available as fastcall function, so it may
2116 only be used in presence of a prototype.
2118 <tag/Availability/cc65
2120 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2126 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2130 <tag/Function/Update the Jiffy clock.
2131 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2132 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2133 <tag/Description/This function adds one count to the Jiffy clock. That clock
2134 counts sixtieths of a second. It is used by the library's <tt/clock()/
2135 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2136 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2137 then that ISR must call this function, in order to keep the clock valid.
2138 <tag/Availability/cc65
2140 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2141 <ref id="clock" name="clock">
2147 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2151 <tag/Function/Send an UNLISTEN command
2152 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2153 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2154 <tag/Description/This function commands all devices on the serial bus to
2155 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2156 function results in an UNLISTEN command being transmitted on the serial
2157 bus. Only devices previously commanded to LISTEN are affected. This
2158 function is normally used after the host computer is finished sending data
2159 to external devices. Sending the UNLISTEN commands the listening devices
2160 to get off the serial bus so it can be used for other purposes.
2161 <tag/Notes/<itemize>
2164 <tag/Availability/cc65
2166 <ref id="cbm_k_listen" name="cbm_k_listen">
2172 <sect1>cclear<label id="cclear"><p>
2176 <tag/Function/Clear part of a line (write a given number of spaces).
2177 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2178 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2179 <tag/Description/The function clears part of a line by writing <tt/length/
2180 spaces in the current text color.
2181 <tag/Notes/<itemize>
2182 <item>The function is only available as fastcall function, so it may
2183 only be used in presence of a prototype.
2185 <tag/Availability/cc65
2187 <ref id="cclearxy" name="cclearxy">,
2188 <ref id="clrscr" name="clrscr">
2194 <sect1>cclearxy<label id="cclearxy"><p>
2198 <tag/Function/Clear part of a line (write a given number of spaces) starting
2199 at a specific screen position.
2200 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2201 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2202 <tag/Description/The function moves the cursor to a specific position, and
2203 will then clear part of the line by writing <tt/length/ spaces in the current
2205 <tag/Notes/<itemize>
2206 <item>The function is only available as fastcall function, so it may
2207 only be used in presence of a prototype.
2209 <tag/Availability/cc65
2211 <ref id="cclear" name="cclear">,
2212 <ref id="clrscr" name="clrscr">
2218 <sect1>cgetc<label id="cgetc"><p>
2222 <tag/Function/Read a character from the keyboard.
2223 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2224 <tag/Declaration/<tt/char cgetc (void);/
2225 <tag/Description/The function reads a character from the keyboard. If there is
2226 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2227 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2228 displayed while waiting.
2229 <tag/Notes/<itemize>
2230 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2231 from that buffer; and, wait only if the buffer is empty.
2232 <item>The keyboard must be scanned periodically, in order for this function to
2233 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2235 <tag/Availability/cc65
2237 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2238 <ref id="cursor" name="cursor">,
2239 <ref id="kbhit" name="kbhit">
2245 <sect1>chline<label id="chline"><p>
2249 <tag/Function/Output a horizontal line in text mode.
2250 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2251 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2252 <tag/Description/The function outputs a horizontal line with the given length
2253 starting at the current cursor position.
2254 <tag/Notes/<itemize>
2255 <item>The character used to draw the horizontal line is system dependent.
2256 If available, a line drawing character is used. Drawing a line that is partially
2257 off screen leads to undefined behaviour.
2258 <item>The function is only available as fastcall function, so it may only be
2259 used in presence of a prototype.
2261 <tag/Availability/cc65
2263 <ref id="chlinexy" name="chlinexy">,
2264 <ref id="cvline" name="cvline">,
2265 <ref id="cvlinexy" name="cvlinexy">
2271 <sect1>chlinexy<label id="chlinexy"><p>
2275 <tag/Function/Output a horizontal line at a given position in text mode.
2276 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2277 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2278 <tag/Description/The function outputs a horizontal line with the given length
2279 starting at a given position.
2280 <tag/Notes/<itemize>
2281 <item>The character used to draw the horizontal line is system dependent.
2282 If available, a line drawing character is used. Drawing a line that is partially
2283 off screen leads to undefined behaviour.
2284 <item>The function is only available as fastcall function, so it may only be
2285 used in presence of a prototype.
2287 <tag/Availability/cc65
2289 <ref id="chline" name="chline">,
2290 <ref id="cvline" name="cvline">,
2291 <ref id="cvlinexy" name="cvlinexy">
2297 <sect1>clearerr<label id="clearerr"><p>
2301 <tag/Function/Clear error and end-of-file status of a stream.
2302 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2303 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2304 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2305 indicators for the stream <tt/f/.
2306 <tag/Notes/<itemize>
2307 <item>The function is only available as fastcall function, so it may only be
2308 used in presence of a prototype.
2310 <tag/Availability/ISO 9899
2312 <ref id="feof" name="feof">,
2313 <ref id="ferror" name="ferror">
2319 <sect1>clock<label id="clock"><p>
2323 <tag/Function/Determine the processor time used.
2324 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2325 <tag/Declaration/<tt/clock_t clock (void);/
2326 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2327 time used by the program. The time is returned in implementation-defined
2328 units. It can be converted to seconds by dividing by the value of the macro
2329 <tt/CLOCKS_PER_SEC/.
2330 <tag/Notes/<itemize>
2331 <item>Since the machines that cc65-generated programs run on cannot run multiple
2332 processes, the function actually will return the time since some
2333 implementation-defined point in the past.
2334 <item>The Jiffy clock must be "running", in order for this function to return
2335 changing values. (See the description of <tt/cbm_k_udtim()/.)
2337 <tag/Availability/ISO 9899
2339 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2340 <ref id="time" name="time">
2346 <sect1>clrscr<label id="clrscr"><p>
2350 <tag/Function/Clear the text screen.
2351 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2352 <tag/Declaration/<tt/void clrscr (void);/
2353 <tag/Description/The function clears the text screen and moves the cursor to
2354 the upper left corner.
2355 <tag/Availability/cc65
2357 <ref id="cclear" name="cclear">,
2358 <ref id="cclearxy" name="cclearxy">
2364 <sect1>close<label id="close"><p>
2368 <tag/Function/Close a file descriptor.
2369 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2370 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2371 <tag/Description/The function closes the given file descriptor. It returns zero
2372 on success and -1 on error. If an error occurs, the cause can be determined by
2373 reading the <tt/errno/ variable.
2374 <tag/Notes/<itemize>
2375 <item>The function is only available as fastcall function, so it may only
2376 be used in presence of a prototype.
2378 <tag/Availability/POSIX 1003.1
2380 <ref id="creat" name="creat">,
2381 <ref id="open" name="open">
2387 <sect1>closedir<label id="closedir"><p>
2391 <tag/Function/Close a directory.
2392 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2393 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2394 <tag/Description/The function closes the given directory descriptor. It returns
2395 zero on success and -1 on error. If an error occurs, the cause can be determined
2396 by reading the <tt/errno/ variable.
2397 <tag/Notes/<itemize>
2398 <item>The function is only available as fastcall function, so it may only
2399 be used in presence of a prototype.
2401 <tag/Availability/POSIX 1003.1
2403 <ref id="opendir" name="opendir">,
2404 <ref id="readdir" name="readdir">
2410 <sect1>creat<label id="creat"><p>
2414 <tag/Function/Create a file.
2415 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2416 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2417 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2418 associated with it. On error, -1 is returned and an error code is stored in
2420 <tag/Notes/<itemize>
2421 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2422 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2423 <item>The function is only available as fastcall function, so it may only
2424 be used in presence of a prototype.
2426 <tag/Availability/POSIX 1003.1
2428 <ref id="close" name="close">,
2429 <ref id="open" name="open">
2435 <sect1>cprintf<label id="cprintf"><p>
2439 <tag/Function/Formatted output to the console.
2440 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2441 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2442 <tag/Description/The arguments are converted to text where necessary and
2443 formatted according to the format string given. The resulting string is output
2444 to the console. <tt/cprintf/ supports the same format specifiers as
2445 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2446 <tag/Notes/<itemize>
2447 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2448 between <tt/\r/ and <tt/\n/.
2450 <tag/Availability/cc65
2452 <ref id="cputc" name="cputc">,
2453 <ref id="cputcxy" name="cputcxy">,
2454 <ref id="cputs" name="cputs">,
2455 <ref id="cputsxy" name="cputsxy">,
2456 <ref id="vcprintf" name="vcprintf">
2462 <sect1>cputc<label id="cputc"><p>
2466 <tag/Function/Output a character directly to the console.
2467 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2468 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2469 <tag/Description/Output one character to the console at the current cursor
2471 <tag/Notes/<itemize>
2472 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2473 between <tt/\r/ and <tt/\n/.
2474 <item>The function is only available as fastcall function, so it may only
2475 be used in presence of a prototype.
2477 <tag/Availability/cc65
2479 <ref id="cprintf" name="cprintf">,
2480 <ref id="cputcxy" name="cputcxy">,
2481 <ref id="cputs" name="cputs">,
2482 <ref id="cputsxy" name="cputsxy">,
2483 <ref id="vcprintf" name="vcprintf">
2489 <sect1>cputcxy<label id="cputcxy"><p>
2493 <tag/Function/Output a character at a specific screen position.
2494 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2495 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2496 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2497 the screen and outputs one character.
2498 <tag/Notes/<itemize>
2499 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2500 between <tt/\r/ and <tt/\n/.
2501 <item>The function is only available as fastcall function, so it may only
2502 be used in presence of a prototype.
2504 <tag/Availability/cc65
2506 <ref id="cprintf" name="cprintf">,
2507 <ref id="cputc" name="cputc">,
2508 <ref id="cputs" name="cputs">,
2509 <ref id="cputsxy" name="cputsxy">,
2510 <ref id="vcprintf" name="vcprintf">
2516 <sect1>cputs<label id="cputs"><p>
2520 <tag/Function/Output a string directly to the console.
2521 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2522 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2523 <tag/Description/The function outputs the given string on the console at the
2524 current cursor position.
2525 <tag/Notes/<itemize>
2526 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2527 between <tt/\r/ and <tt/\n/.
2528 <item>The function is only available as fastcall function, so it may only
2529 be used in presence of a prototype.
2531 <tag/Availability/cc65
2533 <ref id="cprintf" name="cprintf">,
2534 <ref id="cputc" name="cputc">,
2535 <ref id="cputcxy" name="cputcxy">,
2536 <ref id="cputsxy" name="cputsxy">,
2537 <ref id="vcprintf" name="vcprintf">
2543 <sect1>cputsxy<label id="cputsxy"><p>
2547 <tag/Function/Output a string to the console at a given position.
2548 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2549 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2550 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2551 and outputs the string <tt/s/.
2552 <tag/Notes/<itemize>
2553 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2554 between <tt/\r/ and <tt/\n/.
2555 <item>The function is only available as fastcall function, so it may only
2556 be used in presence of a prototype.
2558 <tag/Availability/cc65
2560 <ref id="cprintf" name="cprintf">,
2561 <ref id="cputc" name="cputc">,
2562 <ref id="cputcxy" name="cputcxy">,
2563 <ref id="cputs" name="cputs">,
2564 <ref id="vcprintf" name="vcprintf">
2570 <sect1>cursor<label id="cursor"><p>
2574 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2575 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2576 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2577 <tag/Description/If the argument to the function is non zero, a blinking cursor
2578 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2579 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2580 <tag/Notes/<itemize>
2581 <item>The function is only available as fastcall function, so it may only
2582 be used in presence of a prototype.
2584 <tag/Availability/cc65
2586 <ref id="cgetc" name="cgetc">,
2587 <ref id="kbhit" name="kbhit">
2593 <sect1>cvline<label id="cvline"><p>
2597 <tag/Function/Output a vertical line in text mode.
2598 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2599 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2600 <tag/Description/The function outputs a vertical line with the given length
2601 starting at the current cursor position.
2602 <tag/Notes/<itemize>
2603 <item>The character used to draw the vertical line is system dependent.
2604 If available, a line drawing character is used. Drawing a line that is partially
2605 off screen leads to undefined behaviour.
2606 <item>The function is only available as fastcall function, so it may only be
2607 used in presence of a prototype.
2609 <tag/Availability/cc65
2611 <ref id="chline" name="chline">,
2612 <ref id="chlinexy" name="chlinexy">,
2613 <ref id="cvlinexy" name="cvlinexy">
2619 <sect1>cvlinexy<label id="cvlinexy"><p>
2623 <tag/Function/Output a vertical line at a given position in text mode.
2624 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2625 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2626 <tag/Description/The function outputs a vertical line with the given length
2627 starting at a given position.
2628 <tag/Notes/<itemize>
2629 <item>The character used to draw the vertical line is system dependent.
2630 If available, a line drawing character is used. Drawing a line that is partially
2631 off screen leads to undefined behaviour.
2632 <item>The function is only available as fastcall function, so it may only be
2633 used in presence of a prototype.
2635 <tag/Availability/cc65
2637 <ref id="chline" name="chline">,
2638 <ref id="chlinexy" name="chlinexy">,
2639 <ref id="cvline" name="cvline">
2645 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2649 <tag/Function/Uncompress a LZ4-compressed buffer.
2650 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2651 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2652 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2653 <tag/Notes/<itemize>
2654 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2656 <tag/Availability/cc65
2662 <sect1>div<label id="div"><p>
2666 <tag/Function/Divide two ints and return quotient and remainder.
2667 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2668 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2669 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2670 quotient and remainder in a <tt/div_t/ structure.
2671 <tag/Notes/<itemize>
2672 <item>The function is only available as fastcall function, so it may only
2673 be used in presence of a prototype.
2675 <tag/Availability/ISO 9899
2683 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
2687 <tag/Function/Determines whether the screen is going to be cleared after program exit.
2688 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
2689 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
2690 <tag/Description/The function returns zero if the screen won't be cleared immediately after
2691 program termination. It returns a non-zero value if it will.
2692 <tag/Notes/<itemize>
2693 <item>Some systems, maybe depending on configuration, immediately clear the screen
2694 after a program exits. Therefore it might be difficult to read
2695 the last messages printed by the program prior to its exit. This function can be used
2696 to decide if a delay or wait for a key press should be executed when then program
2699 <tag/Availability/cc65
2707 printf("Hello World\n");
2708 if (doesclrscrafterexit())
2717 <sect1>em_commit<label id="em_commit"><p>
2721 <tag/Function/Commit changes into extended memory.
2722 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2723 <tag/Declaration/<tt/void em_commit (void);/
2724 <tag/Description/Commit changes in the memory window to extended storage. If
2725 the contents of the memory window have been changed, these changes may be lost
2726 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
2727 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
2728 name="em_copyto">/ are called without calling <tt/em_commit/ first.
2729 <tag/Notes/<itemize>
2730 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
2731 memory window are discarded, it does just mean that the drivers is allowed
2733 <item>The function is only available as fastcall function, so it may only be
2734 used in presence of a prototype.
2735 <item>The function produces undefined results if no extended memory driver is
2738 <tag/Availability/cc65
2740 <ref id="em_load_driver" name="em_load_driver">,
2741 <ref id="em_map" name="em_map">,
2742 <ref id="em_use" name="em_use">
2748 <sect1>em_copyfrom<label id="em_copyfrom"><p>
2752 <tag/Function/Copy from extended into normal memory.
2753 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2754 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
2755 <tag/Description/Copy data from extended memory into linear memory. Source and
2756 target addresses as well as the number of bytes to transfer are specified in
2757 the <tt/em_copy/ structure that is passed as a parameter.
2758 <tag/Notes/<itemize>
2759 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
2760 made any changes to the data in the window, call <tt/<ref id="em_commit"
2761 name="em_commit">/ first, or the changes are lost.
2762 <item>The function is only available as fastcall function, so it may only be
2763 used in presence of a prototype.
2764 <item>The function produces undefined results if no extended memory driver is
2767 <tag/Availability/cc65
2769 <ref id="em_commit" name="em_commit">,
2770 <ref id="em_copyto" name="em_copyto">,
2771 <ref id="em_load_driver" name="em_load_driver">
2777 <sect1>em_copyto<label id="em_copyto"><p>
2781 <tag/Function/Copy from normal into extended memory.
2782 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2783 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
2784 <tag/Description/Copy data from linear into extended memory. Source and
2785 target addresses as well as the number of bytes to transfer are specified in
2786 the <tt/em_copy/ structure that is passed as a parameter.
2787 <tag/Notes/<itemize>
2788 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
2789 made any changes to the data in the window, call <tt/<ref id="em_commit"
2790 name="em_commit">/ first, or the changes are lost.
2791 <item>The function is only available as fastcall function, so it may only be
2792 used in presence of a prototype.
2793 <item>The function produces undefined results if no extended memory driver is
2796 <tag/Availability/cc65
2798 <ref id="em_commit" name="em_commit">,
2799 <ref id="em_copyfrom" name="em_copyfrom">,
2800 <ref id="em_load_driver" name="em_load_driver">
2806 <sect1>em_install<label id="em_install"><p>
2810 <tag/Function/Install an already loaded extended memory driver.
2811 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2812 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
2813 <tag/Description/The function installs an already loaded extended memory driver
2814 and returns an error code. The function may be used to install a driver linked
2815 statically to the program.
2816 <tag/Notes/<itemize>
2817 <item>Not all drivers are able to detect if the supported hardware is really
2819 <item>The function is only available as fastcall function, so it may only be
2820 used in presence of a prototype.
2822 <tag/Availability/cc65
2824 <ref id="em_load_driver" name="em_load_driver">,
2825 <ref id="em_uninstall" name="em_uninstall">,
2826 <ref id="em_unload" name="em_unload">
2832 <sect1>em_load_driver<label id="em_load_driver"><p>
2836 <tag/Function/Load and initialize an extended memory driver.
2837 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2838 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
2839 <tag/Description/Load an extended memory driver into memory and initialize
2840 it. The function returns an error code that tells if all this has been
2842 <tag/Notes/<itemize>
2843 <item>Not all drivers are able to detect if the supported hardware is really
2845 <item>The function is only available as fastcall function, so it may only be
2846 used in presence of a prototype.
2847 <item>The driver is loaded by name, so currently you must know the type of
2848 extended memory that should be supported. There is no autodetect capability.
2850 <tag/Availability/cc65
2852 <ref id="em_unload" name="em_unload">
2858 <sect1>em_map<label id="em_map"><p>
2862 <tag/Function/Make a page of extended memory accessible.
2863 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2864 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
2865 <tag/Description/The function maps one page of extended memory into linear
2866 memory and returns a pointer to the page frame. Depending on the hardware
2867 and driver, the data is either mapped into the address space or transfered
2868 into a buffer. If you don't need the actual contents of the page (for example
2869 because you're going to overwrite it completely), it is better to call
2870 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
2871 data if it is possible to avoid that.
2872 <tag/Notes/<itemize>
2873 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
2874 made any changes to the data in the window, call <tt/<ref id="em_commit"
2875 name="em_commit">/ first, or the changes are lost.
2876 <item>The function is only available as fastcall function, so it may only be
2877 used in presence of a prototype.
2878 <item>The function produces undefined results if no extended memory driver is
2881 <tag/Availability/cc65
2883 <ref id="em_commit" name="em_commit">,
2884 <ref id="em_load_driver" name="em_load_driver">,
2885 <ref id="em_use" name="em_use">
2891 <sect1>em_pagecount<label id="em_pagecount"><p>
2895 <tag/Function/Return the number of available extended memory pages.
2896 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2897 <tag/Declaration/<tt/unsigned em_pagecount (void);/
2898 <tag/Description/The function returns the size of the extended memory supported
2899 by the driver in 256 byte pages.
2900 <tag/Notes/<itemize>
2901 <item>The function returns zero if no extended memory driver is loaded.
2902 <item>The function may return zero if the supported hardware was not detected.
2904 <tag/Availability/cc65
2906 <ref id="em_load_driver" name="em_load_driver">
2912 <sect1>em_uninstall<label id="em_uninstall"><p>
2916 <tag/Function/Uninstall an already loaded extended memory driver.
2917 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2918 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
2919 <tag/Description/The function uninstalls an already loaded extended memory
2920 driver but doesn't remove it from memory.
2921 <tag/Notes/<itemize>
2922 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
2923 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
2924 should be used instead of <tt/em_uninstall/ so the driver is also removed
2927 <tag/Availability/cc65
2929 <ref id="em_install" name="em_install">,
2930 <ref id="em_load_driver" name="em_load_driver">,
2931 <ref id="em_unload" name="em_unload">
2937 <sect1>em_unload<label id="em_unload"><p>
2941 <tag/Function/Unload an extended memory driver.
2942 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2943 <tag/Declaration/<tt/unsigned char em_unload (void);/
2944 <tag/Description/The function unloads a loaded extended memory driver and
2945 frees all memory allocated for the driver.
2946 <tag/Notes/<itemize>
2947 <item>The function does nothing if no driver is loaded.
2949 <tag/Availability/cc65
2951 <ref id="em_load_driver" name="em_load_driver">
2957 <sect1>em_use<label id="em_use"><p>
2961 <tag/Function/Prepare an extended memory page for use.
2962 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2963 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
2964 <tag/Description/The function maps one page of extended memory into linear
2965 memory and returns a pointer to the page frame. This function is similar to
2966 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
2967 actual memory window in the assumption that the existing data is wrong or
2968 will get overwritten.
2969 <tag/Notes/<itemize>
2970 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
2971 made any changes to the data in the window, call <tt/<ref id="em_commit"
2972 name="em_commit">/ first, or the changes are lost.
2973 <item>The function is only available as fastcall function, so it may only be
2974 used in presence of a prototype.
2975 <item>The function produces undefined results if no extended memory driver is
2978 <tag/Availability/cc65
2980 <ref id="em_commit" name="em_commit">,
2981 <ref id="em_load_driver" name="em_load_driver">,
2982 <ref id="em_map" name="em_map">
2988 <sect1>exit<label id="exit"><p>
2992 <tag/Function/Terminate the program.
2993 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2994 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
2995 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
2996 return code of the program. Before termination, all files are closed, buffered
2997 output is written and any functions registered with <tt/<ref id="atexit"
2998 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
2999 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3001 <tag/Notes/<itemize>
3002 <item>The function is only available as fastcall function, so it may only
3003 be used in presence of a prototype.
3004 <item>It depends on the host machine if the program return code can be
3005 evaluated or is ignored.
3007 <tag/Availability/ISO 9899
3009 <ref id="abort" name="abort">,
3010 <ref id="exit" name="exit">
3016 <sect1>exec<label id="exec"><p>
3020 <tag/Function/Execute a program file.
3021 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3022 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3023 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3024 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3025 then loading and starting the program named in the first argument, passing
3026 the command line specified as second argument. Instead of an empty string,
3027 a <tt/NULL/ pointer may be passed as second parameter.
3028 On success, the function does not return. On failure, -1 is returned and
3029 <tt/errno/ contains an error code.
3030 <tag/Notes/<itemize>
3031 <item>The function is only available as fastcall function, so it may only
3032 be used in presence of a prototype.
3033 <item>On most platforms, the function needs to copy a small stub loader to
3034 some memory area outside the program space. This may collide with other
3035 programs. See the platform specific docs on this.
3036 <item>Because it is necessary to terminate the running program before the
3037 memory can be reused to load the new one, there is a high chance that the
3038 function may not be able to return on errors.
3039 <item>The command line is passed to the new program in the same way as cc65
3040 programs expect the command line. If the new program is not a cc65 generated
3041 program, it may not be able to read it.
3043 <tag/Availability/cc65
3045 <ref id="exit" name="exit">
3051 <sect1>fast<label id="fast"><p>
3055 <tag/Function/Switch the C128 into 2MHz mode.
3056 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3057 <tag/Declaration/<tt/void fast (void);/
3058 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
3059 will nearly double the speed compared to slow mode.
3060 <tag/Notes/<itemize>
3061 <item>The function is specific to the C128.
3062 <item>2MHz clock will not work in 40 column mode.
3064 <tag/Availability/C128
3066 <ref id="slow" name="slow">,
3067 <ref id="toggle_videomode" name="toggle_videomode">,
3068 <ref id="videomode" name="videomode">
3074 <sect1>feof<label id="feof"><p>
3078 <tag/Function/Return the end-of-file indicator of a stream.
3079 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3080 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3081 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3082 <tt/f/, and returns a non zero value if it is set.
3083 <tag/Notes/<itemize>
3084 <item>The indicator is set only after a read past the end of a file is
3086 <item>The function is only available as fastcall function, so it may only be
3087 used in presence of a prototype.
3089 <tag/Availability/ISO 9899
3091 <ref id="feof" name="clearerr">,
3092 <ref id="ferror" name="ferror">
3098 <sect1>ferror<label id="ferror"><p>
3102 <tag/Function/Return the error indicator of a stream.
3103 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3104 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3105 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3106 <tt/f/, and returns a non zero value if it is set.
3107 <tag/Notes/<itemize>
3108 <item>The function is only available as fastcall function, so it may only be
3109 used in presence of a prototype.
3111 <tag/Availability/ISO 9899
3113 <ref id="feof" name="clearerr">,
3114 <ref id="ferror" name="feof">
3120 <sect1>fileno<label id="fileno"><p>
3124 <tag/Function/Return the file handle used by a stream.
3125 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3126 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3127 <tag/Description/The <tt/fileno/ function returns the file handle used
3128 internally by a C stream. This file handle (an integer) can be used as a
3129 handle for the POSIX input/output functions.
3130 <tag/Notes/<itemize>
3131 <item>The function is only available as fastcall function, so it may only be
3132 used in presence of a prototype.
3133 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3134 file may have unpredictable results.
3136 <tag/Availability/POSIX 1003.1
3138 <ref id="creat" name="creat">,
3139 <ref id="open" name="open"> <!-- , -->
3140 <!-- <ref id="read" name="read">, -->
3141 <!-- <ref id="write" name="write"> -->
3147 <sect1>free<label id="free"><p>
3151 <tag/Function/Free a block of dynamic memory.
3152 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3153 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3154 <tag/Description/Free a block of dynamic memory previously allocated with
3155 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3156 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3157 pointer is <tt/NULL/, no action is performed.
3158 <tag/Notes/<itemize>
3159 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3160 behaviour and may crash your program.
3161 <item>The function is only available as fastcall function, so it may only
3162 be used in presence of a prototype.
3164 <tag/Availability/ISO 9899
3166 <ref id="_heapadd" name="_heapadd">,
3167 <ref id="_heapblocksize" name="_heapblocksize">,
3168 <ref id="_heapmaxavail" name="_heapmaxavail">,
3169 <ref id="_heapmemavail" name="_heapmemavail">,
3170 <ref id="calloc" name="calloc">,
3171 <ref id="malloc" name="malloc">,
3172 <ref id="realloc" name="realloc">
3178 <sect1>get_ostype<label id="get_ostype"><p>
3182 <tag/Function/The function returns the operating system, the program runs on.
3183 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3184 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3185 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3186 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3187 all supported targets. If it exists, it returns a number that identifies the
3188 operating system or machine type, the program runs on. The machine dependent
3189 header files define constants that can be used to check the return code.
3190 <tag/Notes/<itemize>
3191 <item>The function does not exist on all platforms.
3192 <item>The return codes are platform dependent.
3194 <tag/Availability/cc65 (not all platforms)
3200 <sect1>getcpu<label id="getcpu"><p>
3204 <tag/Function/Determine on which CPU the program is running.
3205 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3206 <tag/Declaration/<tt/unsigned char getcpu (void);/
3207 <tag/Description/The function checks on which CPU the code is running. It
3208 returns one of the constants<itemize>
3210 <item><tt/CPU_65C02/
3211 <item><tt/CPU_65816/
3213 <tag/Notes/<itemize>
3214 <item>Other, more exotic CPU types are not disinguished.
3216 <tag/Availability/cc65
3222 <sect1>getenv<label id="getenv"><p>
3226 <tag/Function/Return a value from the environment.
3227 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3228 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3229 <tag/Description/The function searches the environment for an entry that
3230 matches <tt/name/ and returns its value. The environment consists of a list
3231 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3233 <tag/Notes/<itemize>
3234 <item>What exactly is stored in the environment depends on the machine the
3235 program is running on.
3236 <item>The function is only available as fastcall function, so it may only
3237 be used in presence of a prototype.
3239 <tag/Availability/ISO 9899
3245 <sect1>getopt<label id="getopt"><p>
3249 <tag/Function/Parse command line options.
3250 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3251 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3252 const char* optstring);/
3253 <tag/Description/The function parses command line arguments, <tt/argc/ and
3254 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3255 is a string that contains command line option characters. If a character in
3256 <tt/optstring/ is followed by a colon, the option requires an argument. An
3257 option on the command line is recognized if it is one of the option characters
3259 <tt/getopt/ must be called repeatedly. It will return each option character
3260 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3261 option argument is placed in <tt/optarg/, the index of the next element on the
3262 command line to be processed is placed in <tt/optind/.
3263 <tag/Notes/<itemize>
3264 <item>The implementation will not reorder options. A non option on the command
3265 line will terminate option processing. All remaining arguments are not
3266 recognized as options, even if the start with a '-' character.
3267 <item>The function is only available as fastcall function, so it may only
3268 be used in presence of a prototype.
3270 <tag/Availability/POSIX.2
3276 <sect1>gotox<label id="gotox"><p>
3280 <tag/Function/Move the text mode cursor to a new X position.
3281 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3282 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3283 <tag/Description/The function moves the text mode cursor to the specified X
3284 position while leaving the Y position untouched. The leftmost position on the
3285 screen has the coordinate 0.
3286 <tag/Notes/<itemize>
3287 <item>The function is only available as fastcall function, so it may
3288 only be used in presence of a prototype.
3289 <item>Invalid values for the X position (out of screen coordinates) may
3290 lead to undefined behaviour.
3292 <tag/Availability/cc65
3294 <ref id="gotoy" name="gotoy">,
3295 <ref id="gotoxy" name="gotoxy">,
3296 <ref id="wherex" name="wherex">,
3297 <ref id="wherey" name="wherey">
3303 <sect1>gotoxy<label id="gotoxy"><p>
3307 <tag/Function/Move the text mode cursor to a new position.
3308 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3309 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3310 <tag/Description/The function moves the text mode cursor to the specified
3311 position. The leftmost position on the screen has the X coordinate 0, the
3312 topmost line has the Y coordinate 0.
3313 <tag/Notes/<itemize>
3314 <item>The function is only available as fastcall function, so it may only be
3315 used in presence of a prototype.
3316 <item>Invalid values for any of both coordinates (out of screen positions) may
3317 lead to undefined behaviour.
3319 <tag/Availability/cc65
3321 <ref id="gotox" name="gotox">,
3322 <ref id="gotoy" name="gotoy">,
3323 <ref id="wherex" name="wherex">,
3324 <ref id="wherey" name="wherey">
3330 <sect1>gotoy<label id="gotoy"><p>
3334 <tag/Function/Move the text mode cursor to a new Y position.
3335 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3336 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3337 <tag/Description/The function moves the text mode cursor to the specified Y
3338 position while leaving the X position untouched. The uppermost position on the
3339 screen has the coordinate 0.
3340 <tag/Notes/<itemize>
3341 <item>The function is only available as fastcall function, so it may
3342 only be used in presence of a prototype.
3343 <item>Invalid values for the Y position (out of screen coordinates) may lead
3344 to undefined behaviour.
3346 <tag/Availability/cc65
3348 <ref id="gotox" name="gotox">,
3349 <ref id="gotoxy" name="gotoxy">,
3350 <ref id="wherex" name="wherex">,
3351 <ref id="wherey" name="wherey">
3357 <sect1>isalnum<label id="isalnum"><p>
3361 <tag/Function/Check if a given character is a letter or digit.
3362 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3363 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3364 <tag/Description/The function returns a non zero value if the given argument
3365 is a letter or digit. The return value is zero if the character is anything
3367 <tag/Notes/<itemize>
3368 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3369 inline sequence generated by the macro will not work correctly for values
3370 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3371 this range. The non inline function may be accessed by <tt/#undef/'ing
3373 <item>When compiling without <tt/-Os/, the function is only available as
3374 fastcall function, so it may only be used in presence of a prototype.
3376 <tag/Availability/ISO 9899
3378 <ref id="isalpha" name="isalpha">,
3379 <ref id="isascii" name="isascii">,
3380 <ref id="isblank" name="isblank">,
3381 <ref id="iscntrl" name="iscntrl">,
3382 <ref id="isdigit" name="isdigit">,
3383 <ref id="isgraph" name="isgraph">,
3384 <ref id="islower" name="islower">,
3385 <ref id="isprint" name="isprint">,
3386 <ref id="ispunct" name="ispunct">,
3387 <ref id="isspace" name="isspace">,
3388 <ref id="isupper" name="isupper">,
3389 <ref id="isxdigit" name="isxdigit">
3395 <sect1>isalpha<label id="isalpha"><p>
3399 <tag/Function/Check if a given character is a letter.
3400 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3401 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3402 <tag/Description/The function returns a non zero value if the given argument
3403 is a letter. The return value is zero if the character is anything else.
3404 <tag/Notes/<itemize>
3405 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3406 inline sequence generated by the macro will not work correctly for values
3407 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3408 this range. The non inline function may be accessed by <tt/#undef/'ing the
3410 <item>When compiling without <tt/-Os/, the function is only available as
3411 fastcall function, so it may only be used in presence of a prototype.
3413 <tag/Availability/ISO 9899
3415 <ref id="isalnum" name="isalnum">,
3416 <ref id="isascii" name="isascii">,
3417 <ref id="isblank" name="isblank">,
3418 <ref id="iscntrl" name="iscntrl">,
3419 <ref id="isdigit" name="isdigit">,
3420 <ref id="isgraph" name="isgraph">,
3421 <ref id="islower" name="islower">,
3422 <ref id="isprint" name="isprint">,
3423 <ref id="ispunct" name="ispunct">,
3424 <ref id="isspace" name="isspace">,
3425 <ref id="isupper" name="isupper">,
3426 <ref id="isxdigit" name="isxdigit">
3432 <sect1>isascii<label id="isascii"><p>
3436 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3437 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3438 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3439 <tag/Description/The function returns a non zero value if the given argument
3440 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3441 <tag/Notes/<itemize>
3442 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3443 inline sequence generated by the macro will not work correctly for values
3444 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3445 this range. The non inline function may be accessed by <tt/#undef/'ing the
3447 <item>When compiling without <tt/-Os/, the function is only available as
3448 fastcall function, so it may only be used in presence of a prototype.
3450 <tag/Availability/ISO 9899
3452 <ref id="isalnum" name="isalnum">,
3453 <ref id="isalpha" name="isalpha">,
3454 <ref id="isblank" name="isblank">,
3455 <ref id="iscntrl" name="iscntrl">,
3456 <ref id="isdigit" name="isdigit">,
3457 <ref id="isgraph" name="isgraph">,
3458 <ref id="islower" name="islower">,
3459 <ref id="isprint" name="isprint">,
3460 <ref id="ispunct" name="ispunct">,
3461 <ref id="isspace" name="isspace">,
3462 <ref id="isupper" name="isupper">,
3463 <ref id="isxdigit" name="isxdigit">
3469 <sect1>isblank<label id="isblank"><p>
3473 <tag/Function/Check if a given character is a space or tab.
3474 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3475 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3476 <tag/Description/The function returns a non zero value if the given argument
3477 is a space or tab character. The return value is zero if the character is
3479 <tag/Notes/<itemize>
3480 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3481 inline sequence generated by the macro will not work correctly for values
3482 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3483 this range. The non inline function may be accessed by <tt/#undef/'ing the
3485 <item>When compiling without <tt/-Os/, the function is only available as
3486 fastcall function, so it may only be used in presence of a prototype.
3488 <tag/Availability/ISO 9899
3490 <ref id="isalnum" name="isalnum">,
3491 <ref id="isalpha" name="isalpha">,
3492 <ref id="isascii" name="isascii">,
3493 <ref id="iscntrl" name="iscntrl">,
3494 <ref id="isdigit" name="isdigit">,
3495 <ref id="isgraph" name="isgraph">,
3496 <ref id="islower" name="islower">,
3497 <ref id="isprint" name="isprint">,
3498 <ref id="ispunct" name="ispunct">,
3499 <ref id="isspace" name="isspace">,
3500 <ref id="isupper" name="isupper">,
3501 <ref id="isxdigit" name="isxdigit">
3507 <sect1>iscntrl<label id="iscntrl"><p>
3511 <tag/Function/Check if a given character is a control character.
3512 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3513 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3514 <tag/Description/The function returns a non zero value if the given argument
3515 is a control character. The return value is zero if the character is anything
3517 <tag/Notes/<itemize>
3518 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3519 inline sequence generated by the macro will not work correctly for values
3520 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3521 this range. The non inline function may be accessed by <tt/#undef/'ing the
3523 <item>When compiling without <tt/-Os/, the function is only available as
3524 fastcall function, so it may only be used in presence of a prototype.
3526 <tag/Availability/ISO 9899
3528 <ref id="isalnum" name="isalnum">,
3529 <ref id="isalpha" name="isalpha">,
3530 <ref id="isascii" name="isascii">,
3531 <ref id="isblank" name="isblank">,
3532 <ref id="isdigit" name="isdigit">,
3533 <ref id="isgraph" name="isgraph">,
3534 <ref id="islower" name="islower">,
3535 <ref id="isprint" name="isprint">,
3536 <ref id="ispunct" name="ispunct">,
3537 <ref id="isspace" name="isspace">,
3538 <ref id="isupper" name="isupper">,
3539 <ref id="isxdigit" name="isxdigit">
3545 <sect1>isdigit<label id="isdigit"><p>
3549 <tag/Function/Check if a given character is a digit.
3550 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3551 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
3552 <tag/Description/The function returns a non zero value if the given argument
3553 is a digit. The return value is zero if the character is anything else.
3554 <tag/Notes/<itemize>
3555 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3556 inline sequence generated by the macro will not work correctly for values
3557 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3558 this range. The non inline function may be accessed by <tt/#undef/'ing the
3560 <item>When compiling without <tt/-Os/, the function is only available as
3561 fastcall function, so it may only be used in presence of a prototype.
3563 <tag/Availability/ISO 9899
3565 <ref id="isalnum" name="isalnum">,
3566 <ref id="isalpha" name="isalpha">,
3567 <ref id="isascii" name="isascii">,
3568 <ref id="isblank" name="isblank">,
3569 <ref id="iscntrl" name="iscntrl">,
3570 <ref id="isgraph" name="isgraph">,
3571 <ref id="islower" name="islower">,
3572 <ref id="isprint" name="isprint">,
3573 <ref id="ispunct" name="ispunct">,
3574 <ref id="isspace" name="isspace">,
3575 <ref id="isupper" name="isupper">,
3576 <ref id="isxdigit" name="isxdigit">
3582 <sect1>isgraph<label id="isgraph"><p>
3586 <tag/Function/Check if a given character is a printable character (except
3588 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3589 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
3590 <tag/Description/The function returns a non zero value if the given argument
3591 is a printable character with the exception of space. The return value is zero
3592 if the character is anything else.
3593 <tag/Notes/<itemize>
3594 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3595 inline sequence generated by the macro will not work correctly for values
3596 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3597 this range. The non inline function may be accessed by <tt/#undef/'ing the
3599 <item>When compiling without <tt/-Os/, the function is only available as
3600 fastcall function, so it may only be used in presence of a prototype.
3602 <tag/Availability/ISO 9899
3604 <ref id="isalnum" name="isalnum">,
3605 <ref id="isalpha" name="isalpha">,
3606 <ref id="isascii" name="isascii">,
3607 <ref id="isblank" name="isblank">,
3608 <ref id="iscntrl" name="iscntrl">,
3609 <ref id="isdigit" name="isdigit">,
3610 <ref id="islower" name="islower">,
3611 <ref id="isprint" name="isprint">,
3612 <ref id="ispunct" name="ispunct">,
3613 <ref id="isspace" name="isspace">,
3614 <ref id="isupper" name="isupper">,
3615 <ref id="isxdigit" name="isxdigit">
3621 <sect1>islower<label id="islower"><p>
3625 <tag/Function/Check if a given character is a lower case letter.
3626 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3627 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
3628 <tag/Description/The function returns a non zero value if the given argument
3629 is a lower case letter. The return value is zero if the character is anything
3631 <tag/Notes/<itemize>
3632 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3633 inline sequence generated by the macro will not work correctly for values
3634 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3635 this range. The non inline function may be accessed by <tt/#undef/'ing the
3637 <item>When compiling without <tt/-Os/, the function is only available as
3638 fastcall function, so it may only be used in presence of a prototype.
3640 <tag/Availability/ISO 9899
3642 <ref id="isalnum" name="isalnum">,
3643 <ref id="isalpha" name="isalpha">,
3644 <ref id="isascii" name="isascii">,
3645 <ref id="isblank" name="isblank">,
3646 <ref id="iscntrl" name="iscntrl">,
3647 <ref id="isdigit" name="isdigit">,
3648 <ref id="isgraph" name="isgraph">,
3649 <ref id="isprint" name="isprint">,
3650 <ref id="ispunct" name="ispunct">,
3651 <ref id="isspace" name="isspace">,
3652 <ref id="isupper" name="isupper">,
3653 <ref id="isxdigit" name="isxdigit">
3659 <sect1>isprint<label id="isprint"><p>
3663 <tag/Function/Check if a given character is a printable character.
3664 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3665 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
3666 <tag/Description/The function returns a non zero value if the given argument
3667 is a printable character (this includes the space character). The return value
3668 is zero if the character is anything else.
3669 <tag/Notes/<itemize>
3670 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3671 inline sequence generated by the macro will not work correctly for values
3672 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3673 this range. The non inline function may be accessed by <tt/#undef/'ing the
3675 <item>When compiling without <tt/-Os/, the function is only available as
3676 fastcall function, so it may only be used in presence of a prototype.
3678 <tag/Availability/ISO 9899
3680 <ref id="isalnum" name="isalnum">,
3681 <ref id="isalpha" name="isalpha">,
3682 <ref id="isascii" name="isascii">,
3683 <ref id="isblank" name="isblank">,
3684 <ref id="iscntrl" name="iscntrl">,
3685 <ref id="isdigit" name="isdigit">,
3686 <ref id="isgraph" name="isgraph">,
3687 <ref id="islower" name="islower">,
3688 <ref id="ispunct" name="ispunct">,
3689 <ref id="isspace" name="isspace">,
3690 <ref id="isupper" name="isupper">,
3691 <ref id="isxdigit" name="isxdigit">
3697 <sect1>ispunct<label id="ispunct"><p>
3701 <tag/Function/Check if a given character is a printable character but not a
3702 space or an alphanumeric character.
3703 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3704 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
3705 <tag/Description/The function returns a non zero value if the given argument
3706 is a printable character, but not a space or anything alphanumeric. The return
3707 value is zero if the character is anything else.
3708 <tag/Notes/<itemize>
3709 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3710 inline sequence generated by the macro will not work correctly for values
3711 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3712 this range. The non inline function may be accessed by <tt/#undef/'ing the
3714 <item>When compiling without <tt/-Os/, the function is only available as
3715 fastcall function, so it may only be used in presence of a prototype.
3717 <tag/Availability/ISO 9899
3719 <ref id="isalnum" name="isalnum">,
3720 <ref id="isalpha" name="isalpha">,
3721 <ref id="isascii" name="isascii">,
3722 <ref id="isblank" name="isblank">,
3723 <ref id="iscntrl" name="iscntrl">,
3724 <ref id="isdigit" name="isdigit">,
3725 <ref id="isgraph" name="isgraph">,
3726 <ref id="islower" name="islower">,
3727 <ref id="isprint" name="isprint">,
3728 <ref id="isspace" name="isspace">,
3729 <ref id="isupper" name="isupper">,
3730 <ref id="isxdigit" name="isxdigit">
3736 <sect1>isspace<label id="isspace"><p>
3740 <tag/Function/Check if a given character is a white-space character.
3741 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3742 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
3743 <tag/Description/The function returns a non zero value if the given argument
3744 is a white space character. The return value is zero if the character is
3745 anything else. The standard white space characters are: space, formfeed ('\f'),
3746 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
3748 <tag/Notes/<itemize>
3749 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3750 inline sequence generated by the macro will not work correctly for values
3751 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3752 this range. The non inline function may be accessed by <tt/#undef/'ing the
3754 <item>When compiling without <tt/-Os/, the function is only available as
3755 fastcall function, so it may only be used in presence of a prototype.
3757 <tag/Availability/ISO 9899
3759 <ref id="isalnum" name="isalnum">,
3760 <ref id="isalpha" name="isalpha">,
3761 <ref id="isascii" name="isascii">,
3762 <ref id="isblank" name="isblank">,
3763 <ref id="iscntrl" name="iscntrl">,
3764 <ref id="isdigit" name="isdigit">,
3765 <ref id="isgraph" name="isgraph">,
3766 <ref id="islower" name="islower">,
3767 <ref id="isprint" name="isprint">,
3768 <ref id="ispunct" name="ispunct">,
3769 <ref id="isupper" name="isupper">,
3770 <ref id="isxdigit" name="isxdigit">
3776 <sect1>isupper<label id="isupper"><p>
3780 <tag/Function/Check if a given character is an upper case letter.
3781 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3782 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
3783 <tag/Description/The function returns a non zero value if the given argument
3784 is an upper case letter. The return value is zero if the character is anything
3786 <tag/Notes/<itemize>
3787 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3788 inline sequence generated by the macro will not work correctly for values
3789 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3790 this range. The non inline function may be accessed by <tt/#undef/'ing the
3792 <item>When compiling without <tt/-Os/, the function is only available as
3793 fastcall function, so it may only be used in presence of a prototype.
3795 <tag/Availability/ISO 9899
3797 <ref id="isalnum" name="isalnum">,
3798 <ref id="isalpha" name="isalpha">,
3799 <ref id="isascii" name="isascii">,
3800 <ref id="isblank" name="isblank">,
3801 <ref id="iscntrl" name="iscntrl">,
3802 <ref id="isdigit" name="isdigit">,
3803 <ref id="isgraph" name="isgraph">,
3804 <ref id="islower" name="islower">,
3805 <ref id="isprint" name="isprint">,
3806 <ref id="ispunct" name="ispunct">,
3807 <ref id="isspace" name="isspace">,
3808 <ref id="isxdigit" name="isxdigit">
3814 <sect1>isxdigit<label id="isxdigit"><p>
3818 <tag/Function/Check if a given character is a hexadecimal digit.
3819 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3820 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
3821 <tag/Description/The function returns a non zero value if the given argument
3822 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
3823 character is anything else.
3824 <tag/Notes/<itemize>
3825 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3826 inline sequence generated by the macro will not work correctly for values
3827 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3828 this range. The non inline function may be accessed by <tt/#undef/'ing the
3830 <item>When compiling without <tt/-Os/, the function is only available as
3831 fastcall function, so it may only be used in presence of a prototype.
3833 <tag/Availability/ISO 9899
3835 <ref id="isalnum" name="isalnum">,
3836 <ref id="isalpha" name="isalpha">,
3837 <ref id="isascii" name="isascii">,
3838 <ref id="isblank" name="isblank">,
3839 <ref id="iscntrl" name="iscntrl">,
3840 <ref id="isdigit" name="isdigit">,
3841 <ref id="isgraph" name="isgraph">,
3842 <ref id="islower" name="islower">,
3843 <ref id="isprint" name="isprint">,
3844 <ref id="ispunct" name="ispunct">,
3845 <ref id="isspace" name="isspace">,
3846 <ref id="isupper" name="isupper">
3852 <sect1>itoa<label id="itoa"><p>
3856 <tag/Function/Convert an integer into a string.
3857 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3858 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
3859 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
3860 <tt/radix/ as the base.
3861 <tag/Notes/<itemize>
3862 <item>There are no provisions to prevent a buffer overflow.
3863 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
3864 <item>The function is non standard, so it is not available in strict ANSI mode.
3865 You should probably use <tt/sprintf/ instead.
3866 <item>The function is only available as fastcall function, so it may only be
3867 used in presence of a prototype.
3869 <tag/Availability/cc65
3871 <ref id="atoi" name="atoi">,
3872 <ref id="atol" name="atol">,
3873 <ref id="ltoa" name="ltoa">,
3874 <ref id="ultoa" name="ultoa">,
3875 <ref id="utoa" name="utoa">
3881 <sect1>joy_count<label id="joy_count"><p>
3885 <tag/Function/Return the number of joysticks supported by the current driver.
3886 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3887 <tag/Declaration/<tt/unsigned char joy_count (void);/
3888 <tag/Description/The function returns a the number of joysticks supported
3889 by the current joystick driver.
3890 <tag/Notes/<itemize>
3891 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3892 name="joy_load_driver"> before calling this function.
3893 <item>The function returns the number of joysticks supported by the driver.
3894 There's no way to check for the number of actually connected joysticks.
3896 <tag/Availability/cc65
3898 <ref id="joy_load_driver" name="joy_load_driver">,
3899 <ref id="joy_read" name="joy_read">
3905 <sect1>joy_install<label id="joy_install"><p>
3909 <tag/Function/Install an already loaded driver and return an error code.
3910 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3911 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
3912 <tag/Description/The function installs a driver that was already loaded into
3913 memory (or linked statically to the program). It returns an error code
3914 (<tt/JOY_ERR_OK/ in case of success).
3915 <tag/Notes/<itemize>
3916 <item>The function is only available as fastcall function, so it may only be
3917 used in presence of a prototype.
3919 <tag/Availability/cc65
3921 <ref id="joy_load_driver" name="joy_load_driver">,
3922 <ref id="joy_uninstall" name="joy_uninstall">,
3923 <ref id="joy_unload" name="joy_unload">
3929 <sect1>joy_load_driver<label id="joy_load_driver"><p>
3933 <tag/Function/Load a driver from disk and install it.
3934 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3935 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
3936 <tag/Description/The function loads a driver with the given name from disk
3937 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
3938 driver was successfully loaded and installed.
3939 <tag/Notes/<itemize>
3940 <item>The function is only available as fastcall function, so it may only be
3941 used in presence of a prototype.
3943 <tag/Availability/cc65
3945 <ref id="joy_install" name="joy_install">,
3946 <ref id="joy_uninstall" name="joy_uninstall">,
3947 <ref id="joy_unload" name="joy_unload">
3953 <sect1>joy_read<label id="joy_read"><p>
3957 <tag/Function/Read the status of a joystick.
3958 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3959 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
3960 <tag/Description/The function reads the status bits for a joystick. The number
3961 of the joystick is passed as parameter. The result may be examined by using one
3962 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
3963 <tag/Notes/<itemize>
3964 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3965 name="joy_load_driver"> before calling this function.
3966 <item>The function is only available as fastcall function, so it may only be
3967 used in presence of a prototype.
3969 <tag/Availability/cc65
3971 <ref id="joy_count" name="joy_count">,
3972 <ref id="joy_load_driver" name="joy_load_driver">,
3973 <ref id="joy_unload" name="joy_unload">
3979 <sect1>joy_uninstall<label id="joy_uninstall"><p>
3983 <tag/Function/Uninstall the current joystick driver.
3984 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3985 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
3986 <tag/Description/The function uninstalls the currently installed joystick
3987 driver. It does not remove the driver from memory. The function returns an
3988 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
3989 <tag/Notes/<itemize>
3990 <item>A joystick driver must be installed using <ref id="joy_install"
3991 name="joy_install"> before calling this function.
3993 <tag/Availability/cc65
3995 <ref id="joy_install" name="joy_install">,
3996 <ref id="joy_load_driver" name="joy_load_driver">,
3997 <ref id="joy_unload" name="joy_unload">
4003 <sect1>joy_unload<label id="joy_unload"><p>
4007 <tag/Function/Uninstall, then unload the current joystick driver.
4008 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4009 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4010 <tag/Description/The function uninstalls the currently installed joystick
4011 driver and removes it from memory. An error code is returned, which is
4012 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4013 <tag/Notes/<itemize>
4014 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4015 name="joy_load_driver"> before calling this function.
4017 <tag/Availability/cc65
4019 <ref id="joy_load_driver" name="joy_load_driver">
4025 <sect1>kbhit<label id="kbhit"><p>
4029 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4030 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4031 <tag/Declaration/<tt/unsigned char kbhit (void);/
4032 <tag/Description/The function returns a value of zero if there is no character
4033 waiting to be read from the keyboard. It returns non zero otherwise.
4034 <tag/Notes/<itemize>
4035 <item>If the system does not support a keyboard buffer (most systems
4036 do), the function is rather useless.
4038 <tag/Availability/cc65
4040 <ref id="cgetc" name="cgetc">,
4041 <ref id="cursor" name="cursor">
4047 <sect1>kbrepeat<label id="kbrepeat"><p>
4051 <tag/Function/Set the keyboard repeat mode.
4052 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4053 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4054 <tag/Description/This function changes which keys have automatic repeat when
4055 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4056 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4057 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4058 it can be restored later.
4059 <tag/Notes/<itemize>
4060 <item>The function is available only as a fastcall function; so, it may be used
4061 only in the presence of a prototype.
4063 <tag/Availability/cc65
4069 <sect1>labs<label id="labs"><p>
4073 <tag/Function/Returns the absolute value of a long integer.
4074 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4075 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4076 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4078 <tag/Notes/<itemize>
4079 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4080 <item>The function is only available as fastcall function, so it may only be
4081 used in presence of a prototype.
4083 <tag/Availability/ISO 9899
4085 <ref id="abs" name="abs">
4091 <sect1>ltoa<label id="ltoa"><p>
4095 <tag/Function/Convert a long integer into a string.
4096 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4097 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4098 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4099 using <tt/radix/ as the base.
4100 <tag/Notes/<itemize>
4101 <item>There are no provisions to prevent a buffer overflow.
4102 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4103 <item>The function is non standard, so it is not available in strict ANSI mode.
4104 You should probably use <tt/sprintf/ instead.
4105 <item>The function is only available as fastcall function, so it may only be
4106 used in presence of a prototype.
4108 <tag/Availability/cc65
4110 <ref id="atoi" name="atoi">,
4111 <ref id="atol" name="atol">,
4112 <ref id="itoa" name="itoa">,
4113 <ref id="ultoa" name="ultoa">,
4114 <ref id="utoa" name="utoa">
4120 <sect1>localeconv<label id="localeconv"><p>
4124 <tag/Function/Returns a pointer to the current locale structure.
4125 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4126 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4127 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4129 <tag/Notes/<itemize>
4130 <item>cc65 supports only the "C" locale, so even after setting a new locale
4131 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4134 <tag/Availability/ISO 9899
4136 <ref id="setlocale" name="setlocale">
4142 <sect1>longjmp<label id="longjmp"><p>
4146 <tag/Function/Non local goto.
4147 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4148 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4149 <tag/Description/The <tt/longjmp/ function restores a program context from the
4150 data in <tt/buf/, which must have been set by a preceeding call to
4151 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4152 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4154 <tag/Notes/<itemize>
4155 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4156 was called with a value of one.
4157 <item>The function is only available as fastcall function, so it may only
4158 be used in presence of a prototype.
4160 <tag/Availability/ISO 9899
4162 <ref id="setjmp" name="setjmp">
4168 <sect1>malloc<label id="malloc"><p>
4172 <tag/Function/Allocate dynamic memory.
4173 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4174 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4175 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4176 pointer to the allocated memory block. On error (not enough memory available),
4177 <tt/malloc/ returns <tt/NULL/.
4178 <tag/Notes/<itemize>
4179 <item>The function is only available as fastcall function, so it may only
4180 be used in presence of a prototype.
4182 <tag/Availability/ISO 9899
4184 <ref id="_heapadd" name="_heapadd">,
4185 <ref id="_heapblocksize" name="_heapblocksize">,
4186 <ref id="_heapmaxavail" name="_heapmaxavail">,
4187 <ref id="_heapmemavail" name="_heapmemavail">,
4188 <ref id="calloc" name="calloc">,
4189 <ref id="free" name="free">,
4190 <ref id="realloc" name="realloc">,
4191 <ref id="strdup" name="strdup">
4197 <sect1>memchr<label id="memchr"><p>
4201 <tag/Function/Search for a character in a block of raw memory.
4202 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4203 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4204 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4205 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4206 that is of size <tt/count/. Upon completion, the function returns a pointer to
4207 the character found, or a null pointer if the character was not found.
4208 <tag/Notes/<itemize>
4209 <item>The function is only available as fastcall function, so it may only
4210 be used in presence of a prototype.
4212 <tag/Availability/ISO 9899
4214 <ref id="strchr" name="strchr">
4220 <sect1>memcmp<label id="memcmp"><p>
4224 <tag/Function/Compare two memory areas.
4225 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4226 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4227 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4228 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4229 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4230 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4231 <tag/Notes/<itemize>
4232 <item>The function is only available as fastcall function, so it may only
4233 be used in presence of a prototype.
4235 <tag/Availability/ISO 9899
4237 <ref id="strcmp" name="strcmp">,
4238 <ref id="memmove" name="memmove">,
4239 <ref id="memset" name="memset">
4245 <sect1>memcpy<label id="memcpy"><p>
4249 <tag/Function/Copy a memory area.
4250 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4251 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4252 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4253 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4255 <tag/Notes/<itemize>
4256 <item>The result is undefined if the memory areas do overlap. Use
4257 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4258 <item>The function is only available as fastcall function, so it may only
4259 be used in presence of a prototype.
4261 <tag/Availability/ISO 9899
4263 <ref id="_swap" name="_swap">,
4264 <ref id="memmove" name="memmove">,
4265 <ref id="memset" name="memset">
4271 <sect1>memmove<label id="memmove"><p>
4275 <tag/Function/Copy a memory area.
4276 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4277 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4278 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4279 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4281 <tag/Notes/<itemize>
4282 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4283 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4284 <item>The function is only available as fastcall function, so it may only
4285 be used in presence of a prototype.
4287 <tag/Availability/ISO 9899
4289 <ref id="_swap" name="_swap">,
4290 <ref id="memcpy" name="memcpy">,
4291 <ref id="memset" name="memset">
4297 <sect1>memset<label id="memset"><p>
4301 <tag/Function/Fill a memory area.
4302 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4303 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4304 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4305 the value <tt/val/. The function returns <tt/p/.
4306 <tag/Notes/<itemize>
4307 <item>The function is only available as fastcall function, so it may only
4308 be used in presence of a prototype.
4310 <tag/Availability/ISO 9899
4312 <ref id="_swap" name="_swap">,
4313 <ref id="bzero" name="bzero">,
4314 <ref id="memcpy" name="memcpy">,
4315 <ref id="memmove" name="memmove">
4321 <sect1>mod_free<label id="mod_free"><p>
4325 <tag/Function/Free a relocatable module.
4326 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4327 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4328 <tag/Description/The function will free a module loaded into memory by use of
4329 the <tt/<ref id="mod_load" name="mod_load">/ function.
4330 <tag/Notes/<itemize>
4331 <item>The pointer passed as parameter is the pointer to the module memory,
4332 not the pointer to the control structure.
4333 <item>The function is available only as a fastcall function; so, it may be used
4334 only in the presence of a prototype.
4336 <tag/Availability/cc65
4338 <ref id="mod_load" name="mod_load">
4344 <sect1>mod_load<label id="mod_load"><p>
4348 <tag/Function/Load a relocatable module.
4349 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4350 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4351 <tag/Description/The function will load a code module into memory and relocate
4352 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4353 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4354 the module just loaded. Possible error codes are:
4356 <item><tt/MLOAD_OK/ - Module load successful
4357 <item><tt/MLOAD_ERR_READ/ - Read error
4358 <item><tt/MLOAD_ERR_HDR/ - Header error
4359 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4360 <item><tt/MLOAD_ERR_FMT/ - Data format error
4361 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4363 <tag/Notes/<itemize>
4364 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4365 relocatable o65 modules for use with this function.
4366 <item>The function is available only as a fastcall function; so, it may be used
4367 only in the presence of a prototype.
4369 <tag/Availability/cc65
4371 <ref id="mod_free" name="mod_free">
4377 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4381 <tag/Function/Specify a bounding box for the mouse cursor.
4382 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4383 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4384 <tag/Description/The function allows to set a bounding box for mouse movement.
4385 <tag/Notes/<itemize>
4386 <item>The function does not check if the mouse cursor is currently within the
4387 given rectangle. Placing the mouse cursor within the bounding box is the
4388 responsibility of the programmer.
4389 <item>While the bounding box may be larger than the actual screen size, the
4390 standard mouse cursor draw routines may fail to set the cursor to coordinates
4391 outside of the screen area. Depending on the platform, you may have to supply
4392 your own mouse cursor routines.
4393 <item>The function is only available as fastcall function, so it may only be
4394 used in presence of a prototype.
4396 <tag/Availability/cc65
4398 <ref id="mouse_getbox" name="mouse_getbox">,
4399 <ref id="mouse_move" name="mouse_move">
4405 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4409 <tag/Function/Return the current bounding box for the mouse cursor.
4410 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4411 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4412 <tag/Description/The function queries the current bounding box for mouse
4414 <tag/Notes/<itemize>
4415 <item>The function is only available as fastcall function, so it may only be
4416 used in presence of a prototype.
4418 <tag/Availability/cc65
4420 <ref id="mouse_move" name="mouse_move">,
4421 <ref id="mouse_setbox" name="mouse_setbox">
4427 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4431 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4432 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4433 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4434 <tag/Description/The function returns a bit mask that encodes the state of the
4435 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4437 <tag/Availability/cc65
4439 <ref id="mouse_info" name="mouse_info">,
4440 <ref id="mouse_pos" name="mouse_pos">
4446 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4450 <tag/Function/Return a readable error message for an error code.
4451 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4452 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4454 <tag/Description/The function returns an error message (in english) for the
4455 error code passed parameter.
4456 <tag/Notes/<itemize>
4457 <item>The function will return "Unknown error" for invalid error codes.
4458 <item>The function is only available as fastcall function, so it may only be
4459 used in presence of a prototype.
4461 <tag/Availability/cc65
4463 <ref id="mouse_load_driver" name="mouse_load_driver">,
4464 <ref id="mouse_uninstall" name="mouse_uninstall">,
4465 <ref id="mouse_unload" name="mouse_unload">
4471 <sect1>mouse_hide<label id="mouse_hide"><p>
4475 <tag/Function/Hide the mouse pointer.
4476 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4477 <tag/Declaration/<tt/void mouse_hide (void);/
4478 <tag/Description/The function hides the mouse pointer. It manages a counter
4479 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4480 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4481 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4483 <tag/Availability/cc65
4485 <ref id="mouse_show" name="mouse_show">
4491 <sect1>mouse_info<label id="mouse_info"><p>
4495 <tag/Function/Return the state of the mouse buttons and the position of the
4497 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4498 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
4499 <tag/Description/The function returns the state of the mouse buttons and the
4500 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
4501 <tag/Notes/<itemize>
4502 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
4503 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
4504 name="mouse_pos">/ instead.
4505 <item>The function is only available as fastcall function, so it may only be
4506 used in presence of a prototype.
4508 <tag/Availability/cc65
4510 <ref id="mouse_buttons" name="mouse_buttons">,
4511 <ref id="mouse_pos" name="mouse_pos">
4517 <sect1>mouse_install<label id="mouse_install"><p>
4521 <tag/Function/Install an already loaded mouse driver.
4522 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4523 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
4524 mouse_callbacks* c, void* driver);/
4525 <tag/Description/The function installs an already loaded mouse driver and
4526 returns an error code. The <tt/mouse_callbacks/ structure passed as first
4527 parameter contains pointers to routines needed to move or hide/show the mouse
4528 pointer. Defaults for these routines are supplied by the library, so if you
4529 can live with these defaults (which are platform specific), just pass a
4530 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
4531 driver linked statically to the program.
4532 <tag/Notes/<itemize>
4533 <item>Not all drivers are able to detect if the supported hardware is really
4535 <item>After installing a driver, the mouse cursor is hidden.
4536 <item>The function is only available as fastcall function, so it may only be
4537 used in presence of a prototype.
4539 <tag/Availability/cc65
4541 <ref id="mouse_load_driver" name="mouse_load_driver">,
4542 <ref id="mouse_uninstall" name="mouse_uninstall">,
4543 <ref id="mouse_unload" name="mouse_unload">
4549 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
4553 <tag/Function/Call the driver specific ioctl function.
4554 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4555 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
4556 <tag/Description/The function calls the IOCTL entry in the mouse driver,
4557 which is driver specific. The <tt/code/ parameter will choose between
4558 different IOCTL functions, and the <tt/data/ depends on code. The
4559 function returns an error code. The purpose of this function is to allow
4560 for driver specific extensions. See the documentation for a specific mouse
4561 driver for supported ioctl calls.
4562 <tag/Notes/<itemize>
4563 <item>Calling this function is non portable, because each driver may
4564 implement different ioctl calls (or none at all).
4565 <item>The function is only available as fastcall function, so it may only be
4566 used in presence of a prototype.
4568 <tag/Availability/cc65
4574 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
4578 <tag/Function/Load and initialize a mouse driver.
4579 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4580 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
4581 mouse_callbacks* c, const char* driver);/
4582 <tag/Description/Load a mouse driver into memory and initialize it. The
4583 function returns an error code that tells if the call has been successful. The
4584 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
4585 routines needed to move or hide/show the mouse pointer. Defaults for these
4586 routines are supplied by the library, so if you can live with these defaults
4587 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
4588 <tag/Notes/<itemize>
4589 <item>The driver is loaded by name, so currently you must know the type of
4590 mouse that should be supported. There is no autodetect capability.
4591 <item>Not all drivers are able to detect if the supported hardware is really
4593 <item>After installing a driver, the mouse cursor is hidden.
4594 <item>The function is only available as fastcall function, so it may only be
4595 used in presence of a prototype.
4597 <tag/Availability/cc65
4599 <ref id="mouse_install" name="mouse_install">,
4600 <ref id="mouse_uninstall" name="mouse_uninstall">,
4601 <ref id="mouse_unload" name="mouse_unload">
4607 <sect1>mouse_move<label id="mouse_move"><p>
4611 <tag/Function/Move the mouse cursor to a specific position.
4612 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4613 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
4614 <tag/Description/The function updates the mouse position. If the mouse cursor
4615 is visible, it is shown at the new position.
4616 <tag/Notes/<itemize>
4617 <item>The function does not check if the new position is within the bounding
4618 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
4619 <item>The function is only available as fastcall function, so it may only be
4620 used in presence of a prototype.
4622 <tag/Availability/cc65
4624 <ref id="mouse_getbox" name="mouse_getbox">,
4625 <ref id="mouse_setbox" name="mouse_setbox">
4631 <sect1>mouse_pos<label id="mouse_pos"><p>
4635 <tag/Function/Return the position of the mouse.
4636 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4637 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
4638 <tag/Description/The function returns the position of the mouse in the
4639 <tt/mouse_pos/ structure passed as parameter.
4640 <tag/Notes/<itemize>
4641 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
4642 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
4643 name="mouse_info">/ instead.
4644 <item>The function is only available as fastcall function, so it may only be
4645 used in presence of a prototype.
4647 <tag/Availability/cc65
4649 <ref id="mouse_buttons" name="mouse_buttons">,
4650 <ref id="mouse_info" name="mouse_info">
4656 <sect1>mouse_show<label id="mouse_show"><p>
4660 <tag/Function/Show the mouse pointer.
4661 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4662 <tag/Declaration/<tt/void mouse_show (void);/
4663 <tag/Description/The function shows the mouse pointer. It manages a counter
4664 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
4665 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
4666 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
4667 <tag/Availability/cc65
4669 <ref id="mouse_hide" name="mouse_hide">
4675 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
4679 <tag/Function/Uninstall an already loaded mouse driver.
4680 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4681 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
4682 <tag/Description/The function uninstalls an already loaded mouse driver but
4683 don't removes it from memory.
4684 <tag/Notes/<itemize>
4685 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
4686 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
4687 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
4690 <tag/Availability/cc65
4692 <ref id="mouse_install" name="mouse_install">,
4693 <ref id="mouse_load_driver" name="mouse_load_driver">,
4694 <ref id="mouse_unload" name="mouse_unload">
4700 <sect1>mouse_unload<label id="mouse_unload"><p>
4704 <tag/Function/Unload a mouse driver.
4705 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4706 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
4707 <tag/Description/The function unloads a loaded mouse driver and frees all
4708 memory allocated for the driver.
4709 <tag/Notes/<itemize>
4710 <item>The function does nothing if no driver is loaded.
4712 <tag/Availability/cc65
4714 <ref id="mouse_install" name="mouse_install">,
4715 <ref id="mouse_load_driver" name="mouse_load_driver">,
4716 <ref id="mouse_uninstall" name="mouse_uninstall">
4722 <sect1>offsetof<label id="offsetof"><p>
4726 <tag/Function/Calculate the offset of a struct or union member.
4727 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
4728 <tag/Declaration/<tt/size_t offsetof (type, member);/
4729 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
4730 or <tt/union/ member.
4731 <tag/Notes/<itemize>
4732 <item>The function is actually a macro.
4734 <tag/Availability/ISO 9899
4740 <sect1>open<label id="open"><p>
4744 <tag/Function/Open and possibly create a file.
4745 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
4746 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
4747 <tag/Description/<tt/open/ opens a file and returns the file descriptor
4748 associated with it. On error, -1 is returned and an error code is stored in
4749 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
4750 <tag/Notes/<itemize>
4751 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
4752 open, which is used as the permission mask when a new file is created. While
4753 cc65 allows to pass this argument, it is ignored.
4755 <tag/Availability/POSIX 1003.1
4757 <ref id="close" name="close">,
4758 <ref id="creat" name="creat">
4764 <sect1>opendir<label id="opendir"><p>
4768 <tag/Function/Open a directory.
4769 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
4770 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
4771 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
4772 descriptor associated with it. On error, NULL is returned and an error code is
4773 stored in <tt/errno/.
4774 <tag/Notes/<itemize>
4775 <item>The function is only available as fastcall function, so it may only
4776 be used in presence of a prototype.
4778 <tag/Availability/POSIX 1003.1
4780 <ref id="closedir" name="closedir">,
4781 <ref id="readdir" name="readdir">
4787 <sect1>peekbsys<label id="peekbsys"><p>
4791 <tag/Function/Read one byte from a location in the system bank.
4792 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4793 <tt/<ref id="cbm510.h" name="cbm510.h">/
4794 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
4795 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
4796 system bank (bank 15) of the CBM PET-II machines and returns it.
4797 <tag/Notes/<itemize>
4798 <item>The function is only available as fastcall function, so it may only
4799 be used in presence of a prototype.
4800 <item>This function may be a macro depending on the compiler options. The
4801 actual function is accessible by #undef'ing the macro.
4803 <tag/Availability/cc65
4805 <ref id="PEEK" name="PEEK">,
4806 <ref id="PEEKW" name="PEEKW">,
4807 <ref id="peekwsys" name="peekwsys">,
4808 <ref id="pokebsys" name="pokebsys">,
4809 <ref id="pokewsys" name="pokewsys">
4815 <sect1>peekwsys<label id="peekwsys"><p>
4819 <tag/Function/Read one word from a location in the system bank.
4820 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4821 <tt/<ref id="cbm510.h" name="cbm510.h">/
4822 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
4823 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
4824 system bank (bank 15) of the CBM PET-II machines and returns it. Following
4825 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
4826 high byte is read from <tt/addr+1/.
4827 <tag/Notes/<itemize>
4828 <item>The function is only available as fastcall function, so it may only
4829 be used in presence of a prototype.
4830 <item>The order in which the two bytes are read is undefined.
4832 <tag/Availability/cc65
4834 <ref id="PEEK" name="PEEK">,
4835 <ref id="PEEKW" name="PEEKW">,
4836 <ref id="peekbsys" name="peekbsys">,
4837 <ref id="pokebsys" name="pokebsys">,
4838 <ref id="pokewsys" name="pokewsys">
4844 <sect1>perror<label id="perror"><p>
4848 <tag/Function/Print an error message for the error in <tt/errno/.
4849 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4850 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
4851 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
4852 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
4853 a blank. Then the error message for the current contents of <tt/errno/ is
4854 printed followed by a newline. The message output is the same as returned by
4855 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
4856 <tag/Notes/<itemize>
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="_poserror" name="_poserror">,
4863 <ref id="strerror" name="strerror">
4869 <sect1>pokebsys<label id="pokebsys"><p>
4873 <tag/Function/Write one byte to a location in the system bank.
4874 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4875 <tt/<ref id="cbm510.h" name="cbm510.h">/
4876 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
4877 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
4878 system bank (bank 15) of the CBM PET-II machines.
4879 <tag/Notes/<itemize>
4880 <item>The function is only available as fastcall function, so it may only
4881 be used in presence of a prototype.
4883 <tag/Availability/cc65
4885 <ref id="POKE" name="POKE">,
4886 <ref id="POKEW" name="POKEW">,
4887 <ref id="peekbsys" name="peekbsys">,
4888 <ref id="peekwsys" name="peekwsys">,
4889 <ref id="pokewsys" name="pokewsys">
4895 <sect1>pokewsys<label id="pokewsys"><p>
4899 <tag/Function/Write one word to a location in the system bank.
4900 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4901 <tt/<ref id="cbm510.h" name="cbm510.h">/
4902 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
4903 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
4904 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
4905 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
4906 high byte is written to <tt/addr+1/.
4907 <tag/Notes/<itemize>
4908 <item>The function is only available as fastcall function, so it may only
4909 be used in presence of a prototype.
4910 <item>The order in which the two bytes are written is undefined.
4912 <tag/Availability/cc65
4914 <ref id="POKE" name="POKE">,
4915 <ref id="POKEW" name="POKEW">,
4916 <ref id="peekbsys" name="peekbsys">,
4917 <ref id="peekwsys" name="peekwsys">,
4918 <ref id="pokebsys" name="pokebsys">
4924 <sect1>qsort<label id="qsort"><p>
4928 <tag/Function/Sort an array.
4929 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4930 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
4931 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
4932 <tag/Description/<tt/qsort/ sorts an array according to a given compare
4933 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
4934 is the number of elements, <tt/size/ the size of an element and <tt/compare/
4935 the function used to compare the members.
4936 <tag/Notes/<itemize>
4937 <item>If there are multiple members with the same key, the order after calling
4938 the function is undefined.
4939 <item>The function is only available as fastcall function, so it may only
4940 be used in presence of a prototype.
4941 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
4944 <tag/Availability/ISO 9899
4946 <ref id="bsearch" name="bsearch">
4952 <sect1>raise<label id="raise"><p>
4956 <tag/Function/Send a signal to the executing program.
4957 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4958 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
4959 <tag/Description/<tt/raise/ sends the given signal to the program. If the
4960 program has installed a signal handler for the signal, this signal handler
4961 will be executed. If no handler has been installed, the default action for
4962 the raised signal will be taken. The function returns zero on success,
4964 <tag/Notes/<itemize>
4965 <item>The function is only available as fastcall function, so it may only
4966 be used in presence of a prototype.
4968 <tag/Availability/ISO 9899
4970 <ref id="abort" name="abort">,
4971 <ref id="signal" name="signal">
4977 <sect1>rand<label id="rand"><p>
4981 <tag/Function/Return a pseudo random number.
4982 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4983 <tag/Declaration/<tt/int rand (void);/
4984 <tag/Description/The function returns a pseudo random number
4985 between 0 and <tt/RAND_MAX/ (exclusive).
4986 <tag/Notes/<itemize>
4987 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
4988 flow of numbers is generated.
4989 <item>On startup, the function behaves as if <ref id="srand" name="srand">
4990 had been used with an argument of 1.
4992 <tag/Availability/ISO 9899
4994 <ref id="_randomize" name="_randomize">,
4995 <ref id="srand" name="srand">
5001 <sect1>readdir<label id="readdir"><p>
5005 <tag/Function/Read a directory.
5006 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5007 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5008 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5009 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5010 and returns a pointer to it. If the end of directory is reached, or an error
5011 occurs, NULL is returned. In case of errors, an error code is stored into
5013 <tag/Notes/<itemize>
5014 <item>The function is only available as fastcall function, so it may only
5015 be used in presence of a prototype.
5016 <item>The returned pointer may point to a statically allocated instance of
5017 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5019 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5020 confused when opening/closing files between directory reads. So for example a
5021 program that reads the list of files on a disk, and after each call to
5022 <tt/readdir/, opens the file to process it, will fail.<newline>
5023 Possible solutions are reading the directory into memory before processing the
5024 file list, or to reset the directory by seeking to the correct position after
5025 opening/closing a file:
5027 seekdir (DIR, telldir (DIR));
5029 Platforms known to work without problems are: Apple.
5031 <tag/Availability/POSIX 1003.1
5033 <ref id="closedir" name="closedir">,
5034 <ref id="opendir" name="opendir">
5040 <sect1>realloc<label id="realloc"><p>
5044 <tag/Function/Change the size of an allocated memory block.
5045 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5046 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5047 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5048 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5049 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5050 behaves as if <tt/free/ had been called. On error (not enough memory
5051 available), <tt/realloc/ returns <tt/NULL/.
5052 <tag/Notes/<itemize>
5053 <item>The part of the memory block that is returned will have its contents
5055 <item>This function is somewhat dangerous to use. Be careful to save the
5056 pointer you're passing somewhere else, otherwise
5058 ptr = realloc (ptr, size);
5060 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5061 <item>The function is only available as fastcall function, so it may only
5062 be used in presence of a prototype.
5064 <tag/Availability/ISO 9899
5066 <ref id="_heapadd" name="_heapadd">,
5067 <ref id="_heapblocksize" name="_heapblocksize">,
5068 <ref id="_heapmaxavail" name="_heapmaxavail">,
5069 <ref id="_heapmemavail" name="_heapmemavail">,
5070 <ref id="calloc" name="calloc">,
5071 <ref id="free" name="free">,
5072 <ref id="realloc" name="realloc">
5078 <sect1>remove<label id="remove"><p>
5082 <tag/Function/Delete a file.
5083 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5084 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5085 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5086 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5087 code describing the reason for the failure.
5088 <tag/Notes/<itemize>
5089 <item>This function is not available on all cc65 targets (depends on the
5090 availability of file I/O).
5091 <item>The function is only available as fastcall function, so it may only
5092 be used in presence of a prototype.
5094 <tag/Availability/ISO 9899
5096 <ref id="rename" name="rename">,
5097 <ref id="unlink" name="unlink">
5100 #include <stdio.h>
5102 #define FILENAME "helloworld"
5104 if (remove (FILENAME) == 0) {
5105 printf ("We deleted %s successfully\n", FILENAME);
5107 printf ("There was a problem deleting %s\n", FILENAME);
5114 <sect1>rename<label id="rename"><p>
5118 <tag/Function/Rename a file.
5119 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5120 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5121 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5122 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5123 code describing the reason for the failure.
5124 <tag/Notes/<itemize>
5125 <item>This function is not available on all cc65 targets (depends on the
5126 capabilities of the storage devices).
5127 <item>The function is only available as fastcall function, so it may only
5128 be used in presence of a prototype.
5130 <tag/Availability/ISO 9899
5132 <ref id="remove" name="remove">
5135 #include <stdio.h>
5137 #define OLDNAME "textfile.txt"
5138 #define NEWNAME "textfile.bak"
5140 if (rename (OLDNAME, NEWNAME) == 0) {
5141 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5143 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5150 <sect1>reset_brk<label id="reset_brk"><p>
5154 <tag/Function/Resets the break vector to its original value.
5155 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5156 <tag/Declaration/<tt/void reset_brk (void);/
5157 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5158 before a call to <tt/set_brk/.
5159 <tag/Notes/<itemize>
5160 <item>The break vector is reset on program termination, so it's not strictly
5161 necessary to call this function as a part of your clean-up when exitting the program.
5163 <tag/Availability/cc65
5165 <ref id="reset_irq" name="reset_irq">,
5166 <ref id="set_brk" name="set_brk">,
5167 <ref id="set_irq" name="set_irq">
5173 <sect1>reset_irq<label id="reset_irq"><p>
5177 <tag/Function/Resets the C level interrupt request vector.
5178 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5179 <tag/Declaration/<tt/void reset_irq (void);/
5180 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5181 <tag/Notes/<itemize>
5182 <item>The interrupt vector is reset on program termination, so it's not strictly
5183 necessary to call this function as a part of your clean-up when exitting the program.
5185 <tag/Availability/cc65
5187 <ref id="reset_brk" name="reset_brk">,
5188 <ref id="set_brk" name="set_brk">,
5189 <ref id="set_irq" name="set_irq">
5195 <sect1>revers<label id="revers"><p>
5199 <tag/Function/Control revers character display.
5200 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5201 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5202 <tag/Description/If the argument is non zero, the function enables reverse
5203 character display. If the argument is zero, reverse character display is
5204 switched off. The old value of the setting is returned.
5205 <tag/Notes/<itemize>
5206 <item>The function may not be supported by the hardware, in which case
5207 the call is ignored.
5208 <item>The function is only available as fastcall function, so it may only
5209 be used in presence of a prototype.
5211 <tag/Availability/cc65
5213 <ref id="textcolor" name="textcolor">
5219 <sect1>rewinddir<label id="rewinddir"><p>
5223 <tag/Function/Reset a directory stream.
5224 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5225 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5226 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5227 pointed to by <tt/dir/ to the start of the directory.
5228 <tag/Notes/<itemize>
5229 <item>The function is only available as fastcall function, so it may only
5230 be used in presence of a prototype.
5232 <tag/Availability/POSIX 1003.1
5234 <ref id="seekdir" name="seekdir">,
5235 <ref id="telldir" name="telldir">
5241 <sect1>screensize<label id="screensize"><p>
5245 <tag/Function/Return the dimensions of the text mode screen.
5246 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5247 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5248 <tag/Description/The function returns the dimensions of the text mode screen.
5249 <tag/Notes/<itemize>
5250 <item>The function is only available as fastcall function, so it may only
5251 be used in presence of a prototype.
5253 <tag/Availability/cc65
5255 <ref id="gotox" name="gotox">,
5256 <ref id="gotoxy" name="gotoxy">,
5257 <ref id="gotoy" name="gotoy">,
5258 <ref id="wherex" name="wherex">,
5259 <ref id="wherey" name="wherey">
5265 <sect1>seekdir<label id="seekdir"><p>
5269 <tag/Function/Set the position of a directory stream.
5270 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5271 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5272 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5273 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5274 value returned by <tt/<ref id="telldir" name="telldir">/.
5275 <tag/Notes/<itemize>
5276 <item>The function is only available as fastcall function, so it may only
5277 be used in presence of a prototype.
5279 <tag/Availability/POSIX 1003.1
5281 <ref id="rewinddir" name="rewinddir">,
5282 <ref id="telldir" name="telldir">
5288 <sect1>ser_close<label id="ser_close"><p>
5292 <tag/Function/Close the port and disable interrupts
5293 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5294 <tag/Declaration/<tt/unsigned char ser_close (void);/
5295 <tag/Description/Close the port by clearing buffers and disable interrupts.
5296 <tag/Availability/cc65
5297 <tag/See also/Other serial functions.
5302 static void initialize(){
5303 struct ser_params params = {
5310 ser_install(lynx_comlynx); // This will activate the ComLynx
5312 ser_open(&params);
5319 <sect1>ser_get<label id="ser_get"><p>
5323 <tag/Function/Read a character from serial port.
5324 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5325 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5326 <tag/Description/Get a character from the serial port. If no characters are
5327 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5329 <tag/Notes/<itemize>
5330 <item>The function is only available as fastcall function, so it may only
5331 be used in presence of a prototype.
5333 <tag/Availability/cc65
5334 <tag/See also/Other serial functions.
5336 Wait for a character to be available from a serial port.
5339 while (ser_get(&ch) == SER_ERR_NO_DATA)
5346 <sect1>ser_install<label id="ser_install"><p>
5350 <tag/Function/Install an already loaded driver and return an error code.
5351 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5352 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5353 <tag/Description/The function installs a driver that was already loaded into
5354 memory (or linked statically to the program). It returns an error code
5355 (<tt/SER_ERR_OK/ in case of success).
5356 <tag/Notes/<itemize>
5357 <item>The function is only available as fastcall function, so it may only be
5358 used in presence of a prototype.
5360 <tag/Availability/cc65
5362 <ref id="ser_load_driver" name="ser_load_driver">,
5363 <ref id="ser_uninstall" name="ser_uninstall">,
5364 <ref id="ser_unload" name="ser_unload">
5366 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5372 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5376 <tag/Function/Platform dependent code extensions.
5377 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5378 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5379 <tag/Description/Some platforms have extra serial functions that are not
5380 supported by standard serial driver functions. You can extend the driver to support
5381 this extra functionality bt using ser_ioctl functions.
5382 <tag/Notes/<itemize>
5383 <item>The function is only available as fastcall function, so it may only
5384 be used in presence of a prototype.
5385 <item>These functions are not easily portable to other cc65 platforms.
5387 <tag/Availability/cc65
5388 <tag/See also/Other serial functions.
5393 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5397 <tag/Function/Load and install a serial driver.
5398 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5399 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5400 <tag/Description/Load and install the driver by name.
5401 Will just load the driver and check if loading was successful.
5402 <tag/Notes/<itemize>
5403 <item>The function is only available as fastcall function, so it may only
5404 be used in presence of a prototype.
5406 <tag/Availability/cc65
5407 <tag/See also/Other serial functions.
5413 <sect1>ser_open<label id="ser_open"><p>
5417 <tag/Function/Open the port by setting the port parameters and enable interrupts
5418 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5419 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5420 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5421 <tag/Notes/<itemize>
5422 <item>The function is only available as fastcall function, so it may only
5423 be used in presence of a prototype.
5425 <tag/Availability/cc65
5426 <tag/See also/Other serial functions.
5431 static void initialize(){
5432 struct ser_params params = {
5439 ser_install(lynx_comlynx); // This will activate the ComLynx
5441 ser_open(&params);
5448 <sect1>ser_put<label id="ser_put"><p>
5452 <tag/Function/Write a character to a serial port.
5453 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5454 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5455 <tag/Description/Send a character via the serial port. There is a transmit
5456 buffer, but transmitting is not done via interrupt. The function returns
5457 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5458 <tag/Notes/<itemize>
5459 <item>The function is only available as fastcall function, so it may only
5460 be used in presence of a prototype.
5462 <tag/Availability/cc65
5463 <tag/See also/Other serial functions.
5472 <sect1>ser_status<label id="ser_status"><p>
5476 <tag/Function/Return the serial port status.
5477 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5478 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5479 <tag/Description/Return the serial port status.
5480 <tag/Notes/<itemize>
5481 <item>The function is only available as fastcall function, so it may only
5482 be used in presence of a prototype.
5484 <tag/Availability/cc65
5485 <tag/See also/Other serial functions.
5491 <sect1>ser_uninstall<label id="ser_uninstall"><p>
5495 <tag/Function/Uninstall the currently loaded driver but do not unload it.
5496 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5497 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
5498 <tag/Description/Uninstall the currently loaded driver but do not unload it.
5499 <tag/Availability/cc65
5500 <tag/See also/Other serial functions.
5505 <sect1>ser_unload<label id="ser_unload"><p>
5509 <tag/Function/Uninstall, then unload the currently loaded driver.
5510 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5511 <tag/Declaration/<tt/unsigned char ser_unload (void);/
5512 <tag/Description/Uninstall, then unload the currently loaded driver.
5513 <tag/Availability/cc65
5514 <tag/See also/Other serial functions.
5520 <sect1>set_brk<label id="set_brk"><p>
5524 <tag/Function/Set the break vector to a user function.
5525 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5526 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
5527 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
5528 program code by letting the vector point to a user written C function. The
5529 runtime library installs a small stub that saves the registers into global
5530 variables that may be accessed (and changed) by the break handler.
5531 <tag/Notes/<itemize>
5532 <item>The function is only available as fastcall function, so it may only
5533 be used in presence of a prototype.
5534 <item>The stub saves the zero page registers used by the C runtime and switches
5535 to a small break handler stack. This means that it is safe to execute C code,
5536 even if C code was interrupted. Be careful however not to use too many local
5537 variables, and do not enable stack checks for the handler function or any other
5538 function called from it.
5539 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
5540 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
5541 otherwise the <tt/BRK/ instruction will get executed over and over again.
5542 <item>The break vector is reset on program termination, so it's not strictly
5543 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
5544 clean-up when exitting the program.
5546 <tag/Availability/cc65
5548 <ref id="reset_brk" name="reset_brk">
5554 <sect1>set_irq<label id="set_irq"><p>
5558 <tag/Function/Set the C level interrupt request vector to the given address.
5559 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5560 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
5561 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
5562 (IRQs) within the program code by letting the vector point to a user written C
5563 function. The runtime library installs a small stub that saves the zero page
5564 registers used by the C runtime before calling the handler function and restores
5565 them after the handler function returns. Additionally the stub temporarily switches
5566 the C runtime stack to the stack area provided as parameter. If the handler function
5567 was set up to handle a "private", "exclusive" interrupt request source it must
5568 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
5569 interrupt request actually stems from that source. In all other cases it must return
5570 the value <tt/IRQ_NOT_HANDLED/.
5571 <tag/Notes/<itemize>
5572 <item>The function is only available as fastcall function, so it may only
5573 be used in presence of a prototype.
5574 <item>The stub saves the registers and zero page locations used by the C runtime
5575 and switches to the provided stack area. As a consequence, there is some
5576 runtime overhead, but it it is safe to execute C code, even if other C code
5577 was interrupted. Be careful however not to call C library functions, and do not
5578 enable stack checks for the handler function or any other function called from
5580 <item>The interrupt vector is reset on program termination, so it's not strictly
5581 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
5582 clean-up when exitting the program.
5584 <tag/Availability/cc65
5586 <ref id="reset_brk" name="reset_brk">,
5587 <ref id="reset_irq" name="reset_irq">,
5588 <ref id="set_brk" name="set_brk">
5594 <sect1>setjmp<label id="setjmp"><p>
5598 <tag/Function/Save the context for use with <tt/longjmp/.
5599 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
5600 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
5601 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
5602 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
5604 <tag/Notes/<itemize>
5605 <item>The function is only available as fastcall function, so it may only
5606 be used in presence of a prototype.
5607 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
5608 <item><tt/setjmp/ will not save the signal context.
5610 <tag/Availability/ISO 9899
5612 <ref id="longjmp" name="longjmp">
5618 <sect1>setlocale<label id="setlocale"><p>
5622 <tag/Function/Selects a locale.
5623 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
5624 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
5625 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
5626 <tag/Notes/<itemize>
5627 <item>The function is only available as fastcall function, so it may only
5628 be used in presence of a prototype.
5629 <item>cc65 supports only the "C" locale, so calling this function to set a
5630 different locale has no effect.
5632 <tag/Availability/ISO 9899
5634 <ref id="localeconv" name="localeconv">,
5635 <ref id="strcoll" name="strcoll">
5636 <ref id="strxfrm" name="strxfrm">
5642 <sect1>signal<label id="signal"><p>
5646 <tag/Function/Install a signal handler.
5647 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5648 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
5649 <tag/Description/<tt/signal/ installs a handler for the given signal. The
5650 handler may either be a user supplied function, or one of the predefined
5651 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
5652 previous value if the signal , or the special function vector SIG_ERR in
5654 <tag/Notes/<itemize>
5655 <item>The function is only available as fastcall function, so it may only
5656 be used in presence of a prototype.
5658 <tag/Availability/ISO 9899
5660 <ref id="abort" name="abort">,
5661 <ref id="raise" name="raise">
5667 <sect1>sleep<label id="sleep"><p>
5671 <tag/Function/Sleep for a specified amount of time.
5672 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
5673 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
5674 <tag/Description/The function will return after the specified number of
5675 seconds have elapsed.
5676 <tag/Notes/<itemize>
5677 <item>The function is only available as fastcall function, so it may only
5678 be used in presence of a prototype.
5680 <tag/Availability/POSIX 1003.1
5686 <sect1>slow<label id="slow"><p>
5690 <tag/Function/Switch the C128 into 1MHz mode.
5691 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
5692 <tag/Declaration/<tt/void slow (void);/
5693 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
5694 will halve the speed compared to fast mode.
5695 <tag/Notes/<itemize>
5696 <item>The function is specific to the C128.
5698 <tag/Availability/C128
5700 <ref id="fast" name="fast">,
5701 <ref id="toggle_videomode" name="toggle_videomode">,
5702 <ref id="videomode" name="videomode">
5708 <sect1>srand<label id="srand"><p>
5712 <tag/Function/Initialize the pseudo random number generator.
5713 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5714 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
5715 <tag/Description/The function initializes the random number generator using
5716 the given seed. On program startup, the generator behaves as if <tt/srand/ has
5717 been called with an argument of 1.
5718 <tag/Notes/<itemize>
5719 <item>The function is only available as fastcall function, so it may only
5720 be used in presence of a prototype.
5722 <tag/Availability/ISO 9899
5724 <ref id="_randomize" name="_randomize">,
5725 <ref id="rand" name="rand">
5731 <sect1>strcasecmp<label id="strcasecmp"><p>
5735 <tag/Function/Compare two strings case insensitive.
5736 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5737 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
5738 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
5739 as parameters without case sensitivity. It returns a value that is less than
5740 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
5741 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
5742 <tag/Notes/<itemize>
5743 <item>The function is only available as fastcall function, so it may only
5744 be used in presence of a prototype.
5745 <item>The function is not available in strict ANSI mode.
5747 <tag/Availability/cc65
5749 <ref id="strcmp" name="strcmp">,
5750 <ref id="strcoll" name="strcoll">,
5751 <ref id="stricmp" name="stricmp">,
5752 <ref id="strncmp" name="strncmp">,
5753 <ref id="strxfrm" name="strxfrm">
5759 <sect1>strcat<label id="strcat"><p>
5763 <tag/Function/Concatentate two strings.
5764 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5765 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
5766 <tag/Description/The <tt/strcat/ function appends a copy of the string
5767 pointed to by s2 (including the terminating null byte) to the end of the
5768 string pointed to by s1. The initial byte of s2 overwrites the null byte at
5770 <tag/Notes/<itemize>
5771 <item>The function is only available as fastcall function, so it may only
5772 be used in presence of a prototype.
5773 <item>If copying takes place between objects that overlap, the behaviour
5776 <tag/Availability/ISO 9899
5778 <ref id="strcpy" name="strcpy">,
5779 <ref id="strncat" name="strncat">,
5780 <ref id="strncpy" name="strncpy">
5786 <sect1>strchr<label id="strchr"><p>
5790 <tag/Function/Search for a character in a string.
5791 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5792 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
5793 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
5794 (converted to a char) in the string pointed to by <tt/s/. The terminating null
5795 byte is considered to be part of the string. Upon completion, the function
5796 returns a pointer to the byte, or a null pointer if the byte was not found.
5797 <tag/Notes/<itemize>
5798 <item>The function is only available as fastcall function, so it may only
5799 be used in presence of a prototype.
5801 <tag/Availability/ISO 9899
5803 <ref id="memchr" name="memchr">,
5804 <ref id="strrchr" name="strrchr">
5810 <sect1>strcmp<label id="strcmp"><p>
5814 <tag/Function/Compare two strings.
5815 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5816 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
5817 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
5818 parameters. It returns a value that is less than zero if <tt/s1/ is less than
5819 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
5820 if <tt/s1/ is greater than <tt/s2/.
5821 <tag/Notes/<itemize>
5822 <item>The function is only available as fastcall function, so it may only
5823 be used in presence of a prototype.
5825 <tag/Availability/ISO 9899
5827 <ref id="strcasecmp" name="strcasecmp">,
5828 <ref id="strcoll" name="strcoll">,
5829 <ref id="stricmp" name="stricmp">,
5830 <ref id="strncmp" name="strncmp">
5831 <ref id="strxfrm" name="strxfrm">
5837 <sect1>strcoll<label id="strcoll"><p>
5841 <tag/Function/Compare two strings.
5842 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5843 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
5844 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
5845 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
5846 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
5847 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
5848 than zero if <tt/s1/ is greater than <tt/s2/.
5849 <tag/Notes/<itemize>
5850 <item>The function is only available as fastcall function, so it may only
5851 be used in presence of a prototype.
5853 <tag/Availability/ISO 9899
5855 <ref id="setlocale" name="setlocale">,
5856 <ref id="strcasecmp" name="strcasecmp">,
5857 <ref id="strcmp" name="strcmp">,
5858 <ref id="stricmp" name="stricmp">,
5859 <ref id="strncmp" name="strncmp">,
5860 <ref id="strxfrm" name="strxfrm">
5866 <sect1>strcpy<label id="strcpy"><p>
5870 <tag/Function/Copy a string.
5871 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5872 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
5873 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
5874 <tt/s2/ (including the terminating null byte) into the array pointed to by
5875 <tt/s1/. The function will always return <tt/s1/.
5876 <tag/Notes/<itemize>
5877 <item>The function is only available as fastcall function, so it may only
5878 be used in presence of a prototype.
5879 <item>If copying takes place between objects that overlap, the behaviour
5882 <tag/Availability/ISO 9899
5884 <ref id="strcat" name="strcat">,
5885 <ref id="strncat" name="strncat">,
5886 <ref id="strncpy" name="strncpy">
5889 #include <string.h>
5891 static char hello[14];
5893 strcpy (hello, "Hello world!\n");
5899 <sect1>strcspn<label id="strcspn"><p>
5903 <tag/Function/Compute the length of a substring.
5904 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5905 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
5906 <tag/Description/The <tt/strcspn/ function computes and returns the length of
5907 the substring pointed to by <tt/s/ which does <em>not</em> consist of
5908 characters contained in the string <tt/set/.
5909 <tag/Notes/<itemize>
5910 <item>The function is only available as fastcall function, so it may only
5911 be used in presence of a prototype.
5913 <tag/Availability/ISO 9899
5915 <ref id="strqtok" name="strqtok">,
5916 <ref id="strspn" name="strspn">,
5917 <ref id="strstr" name="strstr">,
5918 <ref id="strtok" name="strtok">
5924 <sect1>strdup<label id="strdup"><p>
5928 <tag/Function/Allocate a copy of a string on the heap.
5929 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5930 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
5931 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
5932 to hold a copy of <tt/s/ including the terminating zero. If the allocation
5933 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
5934 memory block, and a pointer to the block is returned.
5935 <tag/Notes/<itemize>
5936 <item>The function is only available as fastcall function, so it may only
5937 be used in presence of a prototype.
5938 <item>It is up to the caller to free the allocated memory block.
5940 <tag/Availability/ISO 9899
5942 <ref id="free" name="free">,
5943 <ref id="malloc" name="malloc">
5949 <sect1>strerror<label id="strerror"><p>
5953 <tag/Function/Return a string describing an error code.
5954 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5955 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
5956 <tag/Description/The <tt/strerror/ function returns a string describing the
5957 given error code. If an invalid error code is passed, the string "Unknown
5958 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
5959 <tt/errno/ is left untouched.
5960 <tag/Notes/<itemize>
5961 <item>The function is only available as fastcall function, so it may only
5962 be used in presence of a prototype.
5963 <item>While the return type of the function is a <tt/char*/, the returned
5964 string must not be modified by the caller!
5966 <tag/Availability/ISO 9899
5968 <ref id="_stroserror" name="_stroserror">
5974 <sect1>stricmp<label id="stricmp"><p>
5978 <tag/Function/Compare two strings case insensitive.
5979 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5980 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
5981 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
5982 parameters without case sensitivity. It returns a value that is less than zero
5983 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
5984 value greater than zero if <tt/s1/ is greater than <tt/s2/.
5985 <tag/Notes/<itemize>
5986 <item>The function is only available as fastcall function, so it may only
5987 be used in presence of a prototype.
5988 <item>The function is not available in strict ANSI mode.
5990 <tag/Availability/cc65
5992 <ref id="strcasecmp" name="strcasecmp">,
5993 <ref id="strcmp" name="strcmp">,
5994 <ref id="strcoll" name="strcoll">,
5995 <ref id="strncmp" name="strncmp">,
5996 <ref id="strxfrm" name="strxfrm">
6002 <sect1>strlen<label id="strlen"><p>
6006 <tag/Function/Return the length of a string.
6007 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6008 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6009 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6010 string to which s points, not including the terminating null byte.
6011 <tag/Notes/<itemize>
6012 <item>The function is only available as fastcall function, so it may only
6013 be used in presence of a prototype.
6014 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6015 function does not work correctly for strings with more than 255 characters.
6017 <tag/Availability/ISO 9899
6019 <ref id="strcpy" name="strcpy">
6025 <sect1>strlower<label id="strlower"><p>
6029 <tag/Function/Make a string lower case.
6030 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6031 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6032 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6033 function to each character of a string. The function will always return <tt/s/.
6034 <tag/Notes/<itemize>
6035 <item>The function is only available as fastcall function, so it may only
6036 be used in presence of a prototype.
6037 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6038 <item>An alias name for this function is <tt/strlwr/.
6040 <tag/Availability/cc65
6042 <ref id="strupper" name="strupper">,
6043 <ref id="tolower" name="tolower">
6049 <sect1>strlwr<label id="strlwr"><p>
6056 <sect1>strncat<label id="strncat"><p>
6060 <tag/Function/Concatentate two strings.
6061 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6062 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6063 <tag/Description/The <tt/strncat/ function appends not more than n characters
6064 of the string pointed to by s2 to the end of the string pointed to by s1. The
6065 terminating null character at the end of s1 is overwritten. A terminating null
6066 character is appended to the result, even if not all of s2 is appended to s1.
6067 <tag/Notes/<itemize>
6068 <item>The function is only available as fastcall function, so it may only
6069 be used in presence of a prototype.
6070 <item>If copying takes place between objects that overlap, the behaviour
6073 <tag/Availability/ISO 9899
6075 <ref id="strcpy" name="strcpy">,
6076 <ref id="strncat" name="strncat">,
6077 <ref id="strncpy" name="strncpy">
6083 <sect1>strncmp<label id="strncmp"><p>
6087 <tag/Function/Compare two strings.
6088 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6089 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6090 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6091 characters of the two strings passed as parameters. It returns a value that is
6092 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6093 <tt/s2/, zero if they are identical, and a value greater than zero they are
6095 <tag/Notes/<itemize>
6096 <item>The function is only available as fastcall function, so it may only
6097 be used in presence of a prototype.
6099 <tag/Availability/ISO 9899
6101 <ref id="strcasecmp" name="strcasecmp">,
6102 <ref id="strcmp" name="strcmp">,
6103 <ref id="strcoll" name="strcoll">,
6104 <ref id="stricmp" name="stricmp">,
6105 <ref id="strxfrm" name="strxfrm">
6111 <sect1>strncpy<label id="strncpy"><p>
6115 <tag/Function/Copy part of a string.
6116 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6117 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6118 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6119 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6120 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6121 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6122 written. The function always will return <tt/s1/.
6123 <tag/Notes/<itemize>
6124 <item>The function is available only as a fastcall function; so, it may be used
6125 only in the presence of a prototype.
6126 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6127 to by <tt/s2/, the result is <em/not/ null-terminated!
6128 <item>If copying takes place between objects that overlap, the behaviour is
6131 <tag/Availability/ISO 9899
6133 <ref id="memcpy" name="memcpy">,
6134 <ref id="strcat" name="strcat">,
6135 <ref id="strcpy" name="strcpy">,
6136 <ref id="strncat" name="strncat">
6141 static char hello[6];
6143 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6149 <sect1>strqtok<label id="strqtok"><p>
6153 <tag/Function/Break a string into tokens.
6154 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6155 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6156 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6157 tokens, which are delimited by either quotation marks or characters from the
6158 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6159 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6160 pointer to the first token in the string <tt/s1/. The following calls must pass
6161 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6162 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6163 <tag/Notes/<itemize>
6164 <item>The function is available only as a fastcall function; so, it may be used
6165 only in the presence of a prototype.
6166 <item><tt/strqtok()/ will modify the string <tt/s1/.
6167 <item>The function will forget where it is in the <tt/s1/ string if it is given
6168 a second <tt/s1/ string before it finishes the first one.
6170 <tag/Availability/cc65
6172 <ref id="strcspn" name="strcspn">,
6173 <!-- <ref id="strpbrk" name="strpbrk">, -->
6174 <ref id="strspn" name="strspn">,
6175 <ref id="strtok" name="strtok">
6181 <sect1>strrchr<label id="strrchr"><p>
6185 <tag/Function/Search for a character in a string.
6186 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6187 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6188 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6189 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6190 byte is considered to be part of the string. Upon completion, the function
6191 returns a pointer to the byte, or a null pointer if the byte was not found.
6192 <tag/Notes/<itemize>
6193 <item>The function is only available as fastcall function, so it may only
6194 be used in presence of a prototype.
6196 <tag/Availability/ISO 9899
6198 <ref id="strchr" name="strchr">
6204 <sect1>strspn<label id="strspn"><p>
6208 <tag/Function/Compute the length of a substring.
6209 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6210 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6211 <tag/Description/The <tt/strspn/ function computes and returns the length of
6212 the substring pointed to by <tt/s/ which does consist only of characters
6213 contained in the string <tt/set/.
6214 <tag/Notes/<itemize>
6215 <item>The function is only available as fastcall function, so it may only
6216 be used in presence of a prototype.
6218 <tag/Availability/ISO 9899
6220 <ref id="strcspn" name="strcspn">,
6221 <ref id="strstr" name="strstr">
6227 <sect1>strstr<label id="strstr"><p>
6231 <tag/Function/Find a substring.
6232 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6233 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6234 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6235 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6236 otherwise it returns <tt/NULL/.
6237 <tag/Notes/<itemize>
6238 <item>The function is only available as fastcall function, so it may only
6239 be used in presence of a prototype.
6241 <tag/Availability/ISO 9899
6243 <ref id="strcspn" name="strcspn">,
6244 <ref id="strspn" name="strspn">
6250 <sect1>strtok<label id="strtok"><p>
6254 <tag/Function/Break a string into tokens.
6255 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6256 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6257 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6258 tokens, which are delimited by characters from the string <tt/s2/. The first call
6259 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6260 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6261 the next token in the string. Different sets of delimiters may be used for the
6262 subsequent calls to <tt/strtok()/.
6263 <tag/Notes/<itemize>
6264 <item>The function is only available as fastcall function, so it may only
6265 be used in presence of a prototype.
6266 <item><tt/strtok()/ will modify the string <tt/s1/.
6267 <item>The function will forget where it is in the <tt/s1/ string if it is given
6268 a second <tt/s1/ string before it finishes the first one.
6270 <tag/Availability/ISO 9899
6272 <ref id="strcspn" name="strcspn">,
6273 <!-- <ref id="strpbrk" name="strpbrk">, -->
6274 <ref id="strqtok" name="strqtok">,
6275 <ref id="strspn" name="strspn">
6281 <sect1>strxfrm<label id="strxfrm"><p>
6285 <tag/Function/Transform a string.
6286 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6287 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6288 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6289 s2 and places the resulting string into the string pointed to by s1. The
6290 transformation is such that if the <tt/strcmp/ function is applied to two
6291 transformed strings, it returns a value greater than, equal to, or less than
6292 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6293 same two original strings. No more than n characters are placed into the
6294 resulting array pointed to by s1, including the terminating null character.
6295 <tag/Notes/<itemize>
6296 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6297 the behaviour is undefined.
6298 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6299 <item>The function is only available as fastcall function, so it may only
6300 be used in presence of a prototype.
6301 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6302 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6304 <tag/Availability/ISO 9899
6306 <ref id="strcmp" name="strcmp">,
6307 <ref id="strcoll" name="strcoll">,
6308 <ref id="strncpy" name="strncpy">
6314 <sect1>strupper<label id="strupper"><p>
6318 <tag/Function/Make a string upper case.
6319 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6320 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6321 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6322 function to each character of a string. The function will always return <tt/s/.
6323 <tag/Notes/<itemize>
6324 <item>The function is only available as fastcall function, so it may only
6325 be used in presence of a prototype.
6326 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6327 <item>An alias name for this function is <tt/strupr/.
6329 <tag/Availability/cc65
6331 <ref id="strlower" name="strlower">
6332 <ref id="toupper" name="toupper">
6338 <sect1>strupr<label id="strupr"><p>
6345 <sect1>telldir<label id="telldir"><p>
6349 <tag/Function/Return the current position of a directory stream.
6350 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6351 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6352 <tag/Description/<tt/telldir/ returns the current position of a directory
6353 stream. The return value may be used in subsequent calls to
6354 <tt/<ref id="seekdir" name="seekdir">/.
6355 <tag/Notes/<itemize>
6356 <item>The function is only available as fastcall function, so it may only
6357 be used in presence of a prototype.
6359 <tag/Availability/POSIX 1003.1
6361 <ref id="seekdir" name="seekdir">,
6362 <ref id="telldir" name="telldir">
6368 <sect1>textcolor<label id="textcolor"><p>
6372 <tag/Function/Set the text color.
6373 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6374 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6375 <tag/Description/The function will set a new text color. It returns the old
6376 (current) text color. Text output using any <tt/conio.h/ function will use
6377 the color set by this function.
6378 <tag/Notes/<itemize>
6379 <item>Text colors are system dependent. The function may have no effect
6380 on systems where the text color cannot be changed.
6381 <item>The function is only available as fastcall function, so it may only
6382 be used in presence of a prototype.
6384 <tag/Availability/cc65
6386 <ref id="bgcolor" name="bgcolor">,
6387 <ref id="bordercolor" name="bordercolor">
6393 <sect1>tgi_arc<label id="tgi_arc"><p>
6397 <tag/Function/Draw an elliptic arc in the current color.
6398 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6399 <tag/Declaration/<tt/void __fastcall__ tgi_arc (int x, int y,
6400 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
6401 <tag/Description/The function draws an elliptic arc with center at x/y and
6402 radii rx/ry using the current drawing color. The arc covers the angle
6403 between sa and ea (startangle and endangle), which must be in the range
6405 <tag/Notes/<itemize>
6406 <item>The function is only available as fastcall function, so it may only
6407 be used in presence of a prototype.
6408 <item>The function behaves unexpectedly or may crash if the angles are out
6411 <tag/Availability/cc65
6413 <ref id="tgi_bar" name="tgi_bar">,
6414 <ref id="tgi_circle" name="tgi_circle">,
6415 <ref id="tgi_ellipse" name="tgi_ellipse">,
6416 <ref id="tgi_pieslice" name="tgi_pieslice">,
6417 <ref id="tgi_setcolor" name="tgi_setcolor">
6419 /* Draw the upper half of an ellipse */
6420 tgi_setcolor(TGI_COLOR_BLUE);
6421 tgi_arc (50, 50, 40, 20, 0, 180);
6427 <sect1>tgi_bar<label id="tgi_bar"><p>
6431 <tag/Function/The function fills a rectangle on the drawpage with the current
6433 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6434 <tag/Declaration/<tt/void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);/
6435 <tag/Description/The function fills a rectangle on the drawpage with the current
6437 <tag/Notes/<itemize>
6438 <item>The function is only available as fastcall function, so it may only
6439 be used in presence of a prototype.
6441 <tag/Availability/cc65
6442 <tag/See also/Other tgi function
6444 tgi_setcolor(TGI_COLOR_GREEN);
6445 tgi_bar(10, 10, 100, 60);
6451 <sect1>tgi_circle<label id="tgi_circle"><p>
6455 <tag/Function/The function draws a circle in the current color.
6456 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6457 <tag/Declaration/<tt/void __fastcall__ tgi_circle (int x, int y, unsigned char radius);/
6458 <tag/Description/The function draws a circle in the current color.
6459 <tag/Notes/<itemize>
6460 <item>The function is only available as fastcall function, so it may only
6461 be used in presence of a prototype.
6463 <tag/Availability/cc65
6465 <ref id="tgi_arc" name="tgi_arc">,
6466 <ref id="tgi_bar" name="tgi_bar">,
6467 <ref id="tgi_ellipse" name="tgi_ellipse">,
6468 <ref id="tgi_pieslice" name="tgi_pieslice">,
6469 <ref id="tgi_setcolor" name="tgi_setcolor">
6471 tgi_setcolor(TGI_COLOR_BLACK);
6472 tgi_circle(50, 40, 40);
6478 <sect1>tgi_clear<label id="tgi_clear"><p>
6482 <tag/Function/Clear the drawpage
6483 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6484 <tag/Declaration/<tt/void tgi_clear (void);/
6485 <tag/Description/Clear the drawpage
6486 <tag/Availability/cc65
6487 <tag/See also/Other tgi functions
6493 <sect1>tgi_done<label id="tgi_done"><p>
6497 <tag/Function/End graphics mode, switch back to text mode.
6498 Will NOT uninstall or unload the driver!
6499 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6500 <tag/Declaration/<tt/void tgi_done (void);/
6501 <tag/Description/End graphics mode, switch back to text mode.
6502 Will NOT uninstall or unload the driver!
6503 <tag/Availability/cc65
6504 <tag/See also/Other tgi functions
6510 <sect1>tgi_ellipse<label id="tgi_ellipse"><p>
6514 <tag/Function/The function draws an ellipse in the current color.
6515 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6516 <tag/Declaration/<tt/void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);/
6517 <tag/Description/The function draws an ellipse at position x/y with radii
6518 rx and ry, using the current drawing color.
6519 <tag/Notes/<itemize>
6520 <item>The function is only available as fastcall function, so it may only
6521 be used in presence of a prototype.
6523 <tag/Availability/cc65
6525 <ref id="tgi_arc" name="tgi_arc">,
6526 <ref id="tgi_bar" name="tgi_bar">,
6527 <ref id="tgi_circle" name="tgi_circle">,
6528 <ref id="tgi_pieslice" name="tgi_pieslice">,
6529 <ref id="tgi_setcolor" name="tgi_setcolor">
6531 tgi_setcolor(TGI_COLOR_RED);
6532 tgi_ellipse (50, 40, 40, 20);
6538 <sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p>
6542 <tag/Function/Free a vector font that was previously loaded into memory.
6543 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6544 <tag/Declaration/<tt/void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);/
6545 <tag/Description/Free a vector font that was previously loaded into memory.
6546 <tag/Notes/<itemize>
6547 <item>The function is only available as fastcall function, so it may only
6548 be used in presence of a prototype.
6550 <tag/Availability/cc65
6552 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6553 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
6559 <sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p>
6561 <quote> <descrip> <tag/Function/Return the pixel aspect ratio.
6562 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6563 <tag/Declaration/<tt/unsigned tgi_getaspectratio (void);/
6564 <tag/Description/The function returns the pixel aspect ratio for the current
6565 driver and display as an 8.8 fixed point value. It may be used to correct
6566 geometric shapes so they look correct on the display. As an example, a circle
6567 with a radius of 100 pixels may look elliptic on some driver/display
6568 combinations if the aspect ratio is not 1.00.
6569 <tag/Notes/<itemize>
6570 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
6571 monitor for the given platform. The aspect ratio may be wrong if another
6573 <item>No TGI function will use the aspect ratio. It is up to the programmer to
6575 <item>The <ref id="tgi_setaspectratio" name="tgi_setaspectratio"> function can
6576 be used to change the aspect ratio for a loaded driver. The value is not reset
6577 by <ref id="tgi_init" name="tgi_init">, so if a driver is linked statically to
6578 an application, switching into and out of graphics mode will not restore the
6579 original aspect ratio.
6581 <tag/Availability/cc65
6583 <ref id="tgi_setaspectratio" name="tgi_setaspectratio">
6589 <sect1>tgi_getcolor<label id="tgi_getcolor"><p>
6593 <tag/Function/Return the current drawing color.
6594 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6595 <tag/Declaration/<tt/unsigned char tgi_getcolor (void);/
6596 <tag/Description/The actual color is an index to a palette. During tgi_init
6597 you will get a default palette. The number of colors depend on the platform.
6598 All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some
6599 platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN
6600 and then you change the green of the palette to blue using tgi_setpalette then
6601 after this painting in TGI_COLOR_GREEN will actually be blue.
6602 <tag/Availability/cc65
6603 <tag/See also/Other tgi functions
6605 color = tgi_getcolor();
6611 <sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p>
6615 <tag/Function/Get the number of available colors.
6616 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6617 <tag/Declaration/<tt/unsigned char tgi_getcolorcount (void);/
6618 <tag/Description/Tgi platforms use indexed color palettes. This function
6619 returns the number of entries we can use in the palette.
6620 <tag/Availability/cc65
6621 <tag/See also/Other tgi functions
6623 if (tgi_getcolorcount() == 2) {
6624 printf("Only monochrome graphics is supported\n");
6631 <sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p>
6635 <tag/Function/Get the palette installed by default.
6636 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6637 <tag/Declaration/<tt/const unsigned char* tgi_getdefpalette (void);/
6638 <tag/Description/The tgi driver has a default palette that is active at startup.
6639 The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this
6640 palette to work correctly.
6641 <tag/Availability/cc65
6642 <tag/See also/Other tgi functions
6648 <sect1>tgi_geterror<label id="tgi_geterror"><p>
6652 <tag/Function/Return the error code for the last operation.
6653 This will also clear the error.
6654 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6655 <tag/Declaration/<tt/unsigned char tgi_geterror (void);/
6656 <tag/Description/Return the error code for the last operation.
6657 This will also clear the error.
6658 <tag/Availability/cc65
6659 <tag/See also/Other tgi functions
6665 <sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p>
6669 <tag/Function/Get an error message describing the error.
6670 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6671 <tag/Declaration/<tt/const char* __fastcall__ tgi_geterrormsg (unsigned char code);/
6672 <tag/Description/Get an error message describing the error.
6673 <tag/Notes/<itemize>
6674 <item>The function is only available as fastcall function, so it may only
6675 be used in presence of a prototype.
6677 <tag/Availability/cc65
6678 <tag/See also/Other tgi functions
6684 <sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p>
6688 <tag/Function/Get the highest index of the palette.
6689 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6690 <tag/Declaration/<tt/unsigned char tgi_getmaxcolor (void);/
6691 <tag/Description/Get the highest index of the palette.
6692 <tag/Availability/cc65
6693 <tag/See also/Other tgi functions
6699 <sect1>tgi_getmaxx<label id="tgi_getmaxx"><p>
6703 <tag/Function/Get the maximum x coordinate that can be used on this screen.
6704 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6705 <tag/Declaration/<tt/unsigned tgi_getmaxx (void);/
6706 <tag/Description/Get the maximum x coordinate that can be used on this screen.
6707 <tag/Availability/cc65
6708 <tag/See also/Other tgi functions
6714 <sect1>tgi_getmaxy<label id="tgi_getmaxy"><p>
6718 <tag/Function/Get the maximum y coordinate that can be used on this screen.
6719 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6720 <tag/Declaration/<tt/unsigned tgi_getmaxy (void);/
6721 <tag/Description/Get the maximum y coordinate that can be used on this screen.
6722 <tag/Availability/cc65
6723 <tag/See also/Other tgi functions
6729 <sect1>tgi_getpagecount<label id="tgi_getpagecount"><p>
6733 <tag/Function/Return the number of screen pages available.
6734 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6735 <tag/Declaration/<tt/unsigned tgi_getpagecount (void);/
6736 <tag/Description/Return the number of screen pages available.
6737 <tag/Availability/cc65
6739 <ref id="tgi_setdrawpage" name="tgi_setdrawpage">,
6740 <ref id="tgi_setviewpage" name="tgi_setviewpage">
6746 <sect1>tgi_getpalette<label id="tgi_getpalette"><p>
6750 <tag/Function/Get the palette installed.
6751 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6752 <tag/Declaration/<tt/const unsigned char* tgi_getpalette (void);/
6753 <tag/Description/Get the palette installed.
6754 <tag/Availability/cc65
6755 <tag/See also/Other tgi functions
6761 <sect1>tgi_getpixel<label id="tgi_getpixel"><p>
6765 <tag/Function/Get the color of a pixel from the viewpage.
6766 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6767 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/
6768 <tag/Description/Get the color of a pixel from the viewpage.
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_getxres<label id="tgi_getxres"><p>
6784 <tag/Function/Get number of horisontal pixels on the screen.
6785 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6786 <tag/Declaration/<tt/unsigned tgi_getxres (void);/
6787 <tag/Description/Get number of horisontal pixels on the screen.
6788 This is same as tgi_maxx()+1.
6789 <tag/Availability/cc65
6790 <tag/See also/Other tgi functions.
6796 <sect1>tgi_getyres<label id="tgi_getyres"><p>
6800 <tag/Function/Get number of vertical pixels on the screen.
6801 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6802 <tag/Declaration/<tt/unsigned tgi_getyres (void);/
6803 <tag/Description/Get number of vertical pixels on the screen.
6804 This is same as tgi_maxy()+1.
6805 <tag/Availability/cc65
6806 <tag/See also/Other tgi functions.
6812 <sect1>tgi_gotoxy<label id="tgi_gotoxy"><p>
6816 <tag/Function/Set graphics cursor at x, y.
6817 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6818 <tag/Declaration/<tt/void __fastcall__ tgi_gotoxy (int x, int y);/
6819 <tag/Description/Set graphics cursor at x, y.
6820 <tag/Notes/<itemize>
6821 <item>The function is only available as fastcall function, so it may only
6822 be used in presence of a prototype.
6824 <tag/Availability/cc65
6825 <tag/See also/Other tgi functions.
6831 <sect1>tgi_init<label id="tgi_init"><p>
6835 <tag/Function/Initialize the already loaded graphics driver.
6836 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6837 <tag/Declaration/<tt/void tgi_init (void);/
6838 <tag/Description/The tgi_init function will set the default palette to the
6840 <tag/Notes/<itemize>
6841 <item><tt/tgi_init/ will not clear the screen. This allows switching between
6842 text and graphics mode on platforms that have separate memory areas for the
6843 screens. If you want the screen cleared, call <tt/<ref id="tgi_clear"
6844 name="tgi_clear">/ after <tt/tgi_init/.
6846 <tag/Availability/cc65
6847 <tag/See also/Other tgi functions.
6849 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6850 tgi_init(); //Set up the default palette and clear the screen.
6856 <sect1>tgi_install<label id="tgi_install"><p>
6860 <tag/Function/Install an already loaded driver and return an error code.
6861 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6862 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_install (void* driver);/
6863 <tag/Description/The function installs a driver that was already loaded into
6864 memory (or linked statically to the program). It returns an error code
6865 (<tt/TGI_ERR_OK/ in case of success).
6866 <tag/Notes/<itemize>
6867 <item>The function is only available as fastcall function, so it may only be
6868 used in presence of a prototype.
6870 <tag/Availability/cc65
6872 <ref id="tgi_load_driver" name="tgi_load_driver">,
6873 <ref id="tgi_uninstall" name="tgi_uninstall">,
6874 <ref id="tgi_unload" name="tgi_unload">
6876 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6877 tgi_init(); //Set up the default palette and clear the screen.
6883 <sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p>
6887 <tag/Function/Install an already loaded driver and return an error code.
6888 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6889 <tag/Declaration/<tt/void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);/
6891 Install a vector font for use. More than one vector font can be loaded,
6892 but only one can be active. This function is used to tell which one. Call
6893 with a NULL pointer to uninstall the currently installed font.
6894 <tag/Notes/<itemize>
6895 <item>The function is only available as fastcall function, so it may only be
6896 used in presence of a prototype.
6898 <tag/Availability/cc65
6900 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6901 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
6907 <sect1>tgi_ioctl<label id="tgi_ioctl"><p>
6911 <tag/Function/Platform dependent code extensions.
6912 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6913 <tag/Declaration/<tt/unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);/
6914 <tag/Description/Some platforms have extra display hardware that is not
6915 supported by standard tgi functions. You can extend the driver to support
6916 this extra hardware using tgi_ioctl functions.
6917 <tag/Notes/<itemize>
6918 <item>The function is only available as fastcall function, so it may only
6919 be used in presence of a prototype.
6920 <item>These functions are not easily portable to other cc65 platforms.
6922 <tag/Availability/cc65
6923 <tag/See also/Other tgi functions.
6925 #define tgi_sprite(spr) tgi_ioctl(0, (void*)(spr))
6926 #define tgi_flip() tgi_ioctl(1, (void*)0)
6927 #define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
6928 #define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
6929 #define tgi_busy() tgi_ioctl(4, (void*)0)
6930 #define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
6932 tgi_sprite(&background);
6933 tgi_setcolor(TGI_COLOR_BLUE);
6934 tgi_outttextxy(20,40,"Hello World");
6935 tgi_updatedisplay();
6942 <sect1>tgi_line<label id="tgi_line"><p>
6946 <tag/Function/Draw a line in the current drawing color.
6947 The graphics cursor will be set to x2/y2 by this call.
6948 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6949 <tag/Declaration/<tt/void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);/
6950 <tag/Description/Draw a line in the current drawing color.
6951 The graphics cursor will be set to x2/y2 by this call.
6952 <tag/Notes/<itemize>
6953 <item>The function is only available as fastcall function, so it may only
6954 be used in presence of a prototype.
6956 <tag/Availability/cc65
6957 <tag/See also/Other tgi functions.
6963 <sect1>tgi_lineto<label id="tgi_lineto"><p>
6967 <tag/Function/Draw a line in the current drawing color from the graphics
6968 cursor to the new end point. The graphics cursor will be updated to x2/y2.
6969 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6970 <tag/Declaration/<tt/void __fastcall__ tgi_lineto (int x2, int y2);/
6971 <tag/Description/Draw a line in the current drawing color from the graphics
6972 cursor to the new end point. The graphics cursor will be updated to x2/y2.
6973 <tag/Notes/<itemize>
6974 <item>The function is only available as fastcall function, so it may only
6975 be used in presence of a prototype.
6977 <tag/Availability/cc65
6978 <tag/See also/Other tgi functions.
6984 <sect1>tgi_load_driver<label id="tgi_load_driver"><p>
6988 <tag/Function/Load and install the given driver.
6989 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6990 <tag/Declaration/<tt/void __fastcall__ tgi_load_driver (const char *name);/
6991 <tag/Description/Load and install the driver by name.
6992 Will just load the driver and check if loading was successful.
6993 Will not switch to graphics mode.
6994 <tag/Notes/<itemize>
6995 <item>The function is only available as fastcall function, so it may only
6996 be used in presence of a prototype.
6998 <tag/Availability/cc65
6999 <tag/See also/Other tgi functions.
7005 <sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p>
7009 <tag/Function/Load the given vector font.
7010 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7011 <tag/Declaration/<tt/const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);/
7013 Load a vector font into memory and return it. In case of errors, NULL is
7014 returned and an error is set, which can be retrieved using tgi_geterror.
7015 To use the font, it has to be installed using tgi_install_vectorfont.
7016 <tag/Notes/<itemize>
7017 <item>The function is only available as fastcall function, so it may only
7018 be used in presence of a prototype.
7020 <tag/Availability/cc65
7022 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">,
7023 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
7029 <sect1>tgi_outtext<label id="tgi_outtext"><p>
7033 <tag/Function/Output text at the current graphics cursor position.
7034 The graphics cursor is moved to the end of the text.
7035 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7036 <tag/Declaration/<tt/void __fastcall__ tgi_outtext (const char* s);/
7037 <tag/Description/Output text at the current graphics cursor position.
7038 The graphics cursor is moved to the end of the text.
7039 <tag/Notes/<itemize>
7040 <item>The function is only available as fastcall function, so it may only
7041 be used in presence of a prototype.
7043 <tag/Availability/cc65
7044 <tag/See also/Other tgi functions.
7050 <sect1>tgi_outtextxy<label id="tgi_outtextxy"><p>
7054 <tag/Function/Output text at the given cursor position.
7055 The graphics cursor is moved to the end of the text.
7056 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7057 <tag/Declaration/<tt/void __fastcall__ tgi_outtextxy (int x, int y, const char* s);/
7058 <tag/Description/Output text at the given cursor position.
7059 The graphics cursor is moved to the end of the text.
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.
7071 <sect1>tgi_pieslice<label id="tgi_pieslice"><p>
7075 <tag/Function/Draw an elliptic pie slice in the current color.
7076 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7077 <tag/Declaration/<tt/void __fastcall__ tgi_pie slice (int x, int y,
7078 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
7079 <tag/Description/The function draws an elliptic pie slice with center at x/y
7080 and radii rx/ry using the current drawing color. The pie slice covers the angle
7081 between sa and ea (startangle and endangle), which must be in the range
7083 <tag/Notes/<itemize>
7084 <item>The function is only available as fastcall function, so it may only
7085 be used in presence of a prototype.
7086 <item>The function behaves unexpectedly or may crash if the angles are out
7089 <tag/Availability/cc65
7091 <ref id="tgi_bar" name="tgi_arc">,
7092 <ref id="tgi_bar" name="tgi_bar">,
7093 <ref id="tgi_circle" name="tgi_circle">,
7094 <ref id="tgi_ellipse" name="tgi_ellipse">,
7095 <ref id="tgi_setcolor" name="tgi_setcolor">
7097 /* Draw the closed upper half of an ellipse */
7098 tgi_setcolor(TGI_COLOR_BLUE);
7099 tgi_pieslice (50, 50, 40, 20, 0, 180);
7105 <sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p>
7107 <quote> <descrip> <tag/Function/Set the pixel aspect ratio.
7108 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7109 <tag/Declaration/<tt/void __fastcall__ tgi_setaspectratio (unsigned ratio);/
7110 <tag/Description/The function sets the pixel aspect ratio for the current
7111 driver and display. The argument is an 8.8 fixed point value. The aspect ratio
7112 may be used to correct geometric shapes so they look correct on a given
7113 display. As an example, a circle with a radius of 100 pixels may look elliptic
7114 on some driver/display combinations if the aspect ratio is not 1.00.
7115 <tag/Notes/<itemize>
7116 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
7117 monitor for the given platform. The aspect ratio may be wrong if another
7119 <item>No TGI function will use the aspect ratio. It is up to the programmer to
7121 <item>The <tt/tgi_setaspectratio/ function can be used to change the aspect
7122 ratio for a loaded driver. The value is not reset by <ref id="tgi_init"
7123 name="tgi_init">, so if a driver is linked statically to an application,
7124 switching into and out of graphics mode will not restore the original aspect
7126 <item>The function is available only as a fastcall function; so, it may be used
7127 only in the presence of a prototype.
7129 <tag/Availability/cc65
7131 <ref id="tgi_getaspectratio" name="tgi_getaspectratio">
7137 <sect1>tgi_setcolor<label id="tgi_setcolor"><p>
7141 <tag/Function/Set color to be used in future draw operations.
7142 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7143 <tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/
7144 <tag/Description/Set color to be used in future draw operations.
7145 <tag/Notes/<itemize>
7146 <item>The function is only available as fastcall function, so it may only
7147 be used in presence of a prototype.
7149 <tag/Availability/cc65
7150 <tag/See also/Other tgi functions.
7152 tgi_setcolor(TGI_COLOR_BLACK);
7154 tgi_setcolor(TGI_COLOR_WHITE);
7155 tgi_bar(10,10,20,20);
7160 <sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p>
7164 <tag/Function/Set the page for drawing.
7165 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7166 <tag/Declaration/<tt/void __fastcall__ tgi_setdrawpage (unsigned char page);/
7167 <tag/Description/If the drawpage and the viewpage are the same then all drawing
7168 is seen immediately as it is drawn. For double buffered games you can set the
7169 drawpage to a different page than the viewpage. This lets you draw the next
7170 screen in the background and when the screen is ready you display it.
7171 <tag/Notes/<itemize>
7172 <item>The function is only available as fastcall function, so it may only
7173 be used in presence of a prototype.
7175 <tag/Availability/cc65
7176 <tag/See also/Other tgi functions.
7179 tgi_outtextxy(10, 10, "Hello World");
7180 tgi_setviewpage(1); // Show page 1
7182 tgi_outtextxy(10, 10, "Creating next frame");
7184 tgi_setviewpage(0); // Show page 0
7189 <sect1>tgi_setpalette<label id="tgi_setpalette"><p>
7193 <tag/Function/Set the palette (not available with all drivers/hardware).
7194 Palette is a pointer to as many entries as there are colors.
7195 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7196 <tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/
7197 <tag/Description/Set the palette (not available with all drivers/hardware).
7198 Palette is a pointer to as many entries as there are colors.
7199 <tag/Notes/<itemize>
7200 <item>The function is only available as fastcall function, so it may only
7201 be used in presence of a prototype.
7203 <tag/Availability/cc65
7204 <tag/See also/Other tgi functions.
7209 <sect1>tgi_setpixel<label id="tgi_setpixel"><p>
7213 <tag/Function/Plot a pixel on the drawpage with the current color.
7214 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7215 <tag/Declaration/<tt/void __fastcall__ tgi_setpixel (int x, int y);/
7216 <tag/Description/Plot a pixel on the drawpage with the current color.
7217 <tag/Notes/<itemize>
7218 <item>The function is only available as fastcall function, so it may only
7219 be used in presence of a prototype.
7221 <tag/Availability/cc65
7222 <tag/See also/Other tgi functions.
7227 <sect1>tgi_setviewpage<label id="tgi_setviewpage"><p>
7231 <tag/Function/Set page to be visible on screen.
7232 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7233 <tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/
7234 <tag/Description/If the drawpage and the viewpage are the same then all drawing
7235 is seen immediately as it is drawn. For double buffered games you can set the
7236 drawpage to a different page than the viewpage. This lets you draw the next
7237 screen in the background and when the screen is ready you display it.
7238 <tag/Notes/<itemize>
7239 <item>The function is only available as fastcall function, so it may only
7240 be used in presence of a prototype.
7242 <tag/Availability/cc65
7243 <tag/See also/Other tgi functions.
7246 tgi_outtextxy(10, 10, "Hello World");
7247 tgi_setviewpage(1); // Show page 1
7249 tgi_outtextxy(10, 10, "Creating next frame");
7251 tgi_setviewpage(0); // Show page 0
7256 <sect1>tgi_gettextheight<label id="tgi_gettextheight"><p>
7260 <tag/Function/Calculate the height of the text in pixels according to
7261 the current text style.
7262 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7263 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/
7264 <tag/Description/Calculate the height of the text in pixels according to
7265 the current text style.
7266 <tag/Notes/<itemize>
7267 <item>The function is only available as fastcall function, so it may only
7268 be used in presence of a prototype.
7270 <tag/Availability/cc65
7271 <tag/See also/Other tgi functions.
7276 <sect1>tgi_settextscale<label id="tgi_settextscale"><p>
7280 <tag/Function/Set the scaling for text output.
7281 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7282 <tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/
7284 Set the scaling for text output. The scaling factors for width and height
7285 are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
7286 <tag/Notes/<itemize>
7287 <item>The function is only available as fastcall function, so it may only
7288 be used in presence of a prototype.
7290 <tag/Availability/cc65
7292 <ref id="tgi_settextstyle" name="tgi_settextstyle">
7297 <sect1>tgi_settextstyle<label id="tgi_settextstyle"><p>
7301 <tag/Function/Set the style for text output.
7302 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7303 <tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/
7304 <tag/Description/Set the style for text output.
7305 <tag/Notes/<itemize>
7306 <item>The function is only available as fastcall function, so it may only
7307 be used in presence of a prototype.
7309 <tag/Availability/cc65
7311 <ref id="tgi_settextscale" name="tgi_settextscale">
7316 <sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p>
7320 <tag/Function/Calculate the width of the text in pixels according to the current text style.
7321 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7322 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/
7323 <tag/Description/Calculate the width of the text in pixels according to the current text style.
7324 <tag/Notes/<itemize>
7325 <item>The function is only available as fastcall function, so it may only
7326 be used in presence of a prototype.
7328 <tag/Availability/cc65
7329 <tag/See also/Other tgi functions.
7334 <sect1>tgi_uninstall<label id="tgi_uninstall"><p>
7338 <tag/Function/Uninstall the currently loaded driver but do not unload it.
7339 Will call tgi_done if necessary.
7340 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7341 <tag/Declaration/<tt/void tgi_uninstall (void);/
7342 <tag/Description/Uninstall the currently loaded driver but do not unload it.
7343 Will call tgi_done if necessary.
7344 <tag/Availability/cc65
7345 <tag/See also/Other tgi functions.
7350 <sect1>tgi_unload<label id="tgi_unload"><p>
7354 <tag/Function/Uninstall, then unload the currently loaded driver.
7355 Will call tgi_done if necessary.
7356 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7357 <tag/Declaration/<tt/void tgi_unload (void);/
7358 <tag/Description/Uninstall, then unload the currently loaded driver.
7359 Will call tgi_done if necessary.
7360 <tag/Availability/cc65
7361 <tag/See also/Other tgi functions.
7366 <sect1>time<label id="time"><p>
7370 <tag/Function/Get the time.
7371 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7372 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7373 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7374 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7375 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7376 returned and <tt/errno/ is set to <tt/ENOSYS/.
7377 <tag/Notes/<itemize>
7378 <item>The function is only available as fastcall function, so it may
7379 only be used in presence of a prototype.
7380 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7381 returned value may not be valid.
7383 <tag/Availability/ISO 9899
7385 <ref id="clock" name="clock">
7391 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7395 <tag/Function/Toggle between 40 and 80 column mode.
7396 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7397 <tag/Declaration/<tt/void toggle_videomode (void);/
7398 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7399 old mode (cursor position, color and so on) are saved and restored together
7401 <tag/Notes/<itemize>
7402 <item>The function is specific to the C128.
7403 <item>This function is deprecated. Please use <ref id="videomode"
7404 name="videomode"> instead!
7406 <tag/Availability/C128
7408 <ref id="fast" name="fast">,
7409 <ref id="slow" name="slow">,
7410 <ref id="videomode" name="videomode">
7416 <sect1>tolower<label id="tolower"><p>
7420 <tag/Function/Convert a character into its lower case representation.
7421 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7422 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7423 <tag/Description/The function returns the given character converted to lower
7424 case. If the given character is not a letter, it is returned unchanged.
7425 <tag/Notes/<itemize>
7426 <item>The function is only available as fastcall function, so it may
7427 only be used in presence of a prototype.
7429 <tag/Availability/ISO 9899
7431 <ref id="islower" name="islower">,
7432 <ref id="isupper" name="isupper">,
7433 <ref id="toupper" name="toupper">
7439 <sect1>toupper<label id="toupper"><p>
7443 <tag/Function/Convert a character into its upper case representation.
7444 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7445 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7446 <tag/Description/The function returns the given character converted to upper
7447 case. If the given character is not a letter, it is returned unchanged.
7448 <tag/Notes/<itemize>
7449 <item>The function is only available as fastcall function, so it may
7450 only be used in presence of a prototype.
7452 <tag/Availability/ISO 9899
7454 <ref id="islower" name="islower">,
7455 <ref id="isupper" name="isupper">,
7456 <ref id="tolower" name="tolower">
7462 <sect1>ultoa<label id="ultoa"><p>
7466 <tag/Function/Convert an unsigned long integer into a string.
7467 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7468 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7469 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7470 string using <tt/radix/ as the base.
7471 <tag/Notes/<itemize>
7472 <item>There are no provisions to prevent a buffer overflow.
7473 <item>The function is non standard, so it is not available in strict ANSI mode.
7474 You should probably use <tt/sprintf/ instead.
7475 <item>The function is only available as fastcall function, so it may only be
7476 used in presence of a prototype.
7478 <tag/Availability/cc65
7480 <ref id="atoi" name="atoi">,
7481 <ref id="atol" name="atol">,
7482 <ref id="itoa" name="itoa">,
7483 <ref id="ltoa" name="ltoa">,
7484 <ref id="utoa" name="utoa">
7490 <sect1>unlink<label id="unlink"><p>
7494 <tag/Function/Delete a file.
7495 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7496 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7497 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7498 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7499 code describing the reason for the failure.
7500 <tag/Notes/<itemize>
7501 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7502 name="remove">/ instead, which is a native ANSI C function and does the same.
7503 <item>This function is not available on all cc65 targets (depends on the
7504 availability of file I/O).
7505 <item>The function is only available as fastcall function, so it may only
7506 be used in presence of a prototype.
7507 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7508 used, which has the same semantics, but is more portable, because it conforms
7509 to the ISO C standard.
7511 <tag/Availability/POSIX 1003.1
7513 <ref id="remove" name="remove">
7516 #include <stdio.h>
7517 #include <unistd.h>
7519 #define FILENAME "helloworld"
7521 if (unlink (FILENAME) == 0) {
7522 printf ("We deleted %s successfully\n", FILENAME);
7524 printf ("There was a problem deleting %s\n", FILENAME);
7531 <sect1>utoa<label id="utoa"><p>
7535 <tag/Function/Convert an unsigned integer into a string.
7536 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7537 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7538 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7539 using <tt/radix/ as the base.
7540 <tag/Notes/<itemize>
7541 <item>There are no provisions to prevent a buffer overflow.
7542 <item>The function is non standard, so it is not available in strict ANSI mode.
7543 You should probably use <tt/sprintf/ instead.
7544 <item>The function is only available as fastcall function, so it may only be
7545 used in presence of a prototype.
7547 <tag/Availability/cc65
7549 <ref id="atoi" name="atoi">,
7550 <ref id="atol" name="atol">,
7551 <ref id="itoa" name="itoa">,
7552 <ref id="ltoa" name="ltoa">,
7553 <ref id="ultoa" name="ultoa">
7559 <sect1>vcprintf<label id="vcprintf"><p>
7563 <tag/Function/Formatted output to the console.
7564 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7565 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7566 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7567 text where necessary and formatted according to the format string given. The
7568 resulting string is output to the console. <tt/vcprintf/ supports the same
7569 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7570 <tag/Notes/<itemize>
7571 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7572 between <tt/\r/ and <tt/\n/.
7573 <item>The function is only available as fastcall function, so it may only be
7574 used in presence of a prototype.
7576 <tag/Availability/cc65
7578 <ref id="cprintf" name="cprintf">,
7579 <ref id="cputc" name="cputc">,
7580 <ref id="cputcxy" name="cputcxy">,
7581 <ref id="cputs" name="cputs">,
7582 <ref id="cputsxy" name="cputsxy">
7588 <sect1>videomode<label id="videomode"><p>
7592 <tag/Function/Switch to either 40 or 80 column mode.
7593 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7594 <ref id="c128.h" name="c128.h">/
7595 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7596 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7597 the requested mode is already active, nothing happens. The old mode is returned
7599 <tag/Notes/<itemize>
7600 <item>The function is specific to the C128 and enhanced Apple //e.
7601 <item>This function replaces <ref id="toggle_videomode"
7602 name="toggle_videomode">.
7603 <item>The function is only available as fastcall function, so it may only be
7604 used in presence of a prototype.
7606 <tag/Availability/C128 and enhanced Apple //e
7608 <ref id="fast" name="fast">,
7609 <ref id="slow" name="slow">,
7610 <ref id="toggle_videomode" name="toggle_videomode">
7616 <sect1>waitvsync<label id="waitvsync"><p>
7620 <tag/Function/Wait until the start of the next frame.
7622 <tt/<ref id="cbm.h" name="cbm.h">/,
7623 <tt/<ref id="gamate.h" name="gamate.h">/,
7624 <tt/<ref id="nes.h" name="nes.h">/,
7625 <tt/<ref id="pce.h" name="pce.h">/
7626 <tag/Declaration/<tt/void waitvsync (void);/
7627 <tag/Description/Wait for vertical sync to reduce flickering.
7628 <tag/Availability/Platforms above
7634 <sect1>wherex<label id="wherex"><p>
7638 <tag/Function/Return the current X position of the text mode cursor.
7639 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7640 <tag/Declaration/<tt/unsigned char wherex (void);/
7641 <tag/Description/The function returns the current X position of the text mode
7642 cursor. Zero is returned for the leftmost screen position.
7643 <tag/Availability/cc65
7645 <ref id="gotox" name="gotox">,
7646 <ref id="gotoy" name="gotoy">,
7647 <ref id="gotoxy" name="gotoxy">,
7648 <ref id="wherey" name="wherey">
7654 <sect1>wherey<label id="wherey"><p>
7658 <tag/Function/Return the current Y position of the text mode cursor.
7659 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7660 <tag/Declaration/<tt/unsigned char wherey (void);/
7661 <tag/Description/The function returns the current Y position of the text mode
7662 cursor. Zero is returned for the uppermost screen position.
7663 <tag/Availability/cc65
7665 <ref id="gotox" name="gotox">,
7666 <ref id="gotoy" name="gotoy">,
7667 <ref id="gotoxy" name="gotoxy">,
7668 <ref id="wherex" name="wherex">