1 <!doctype linuxdoc system> <!-- -*- text-mode -*- -->
4 <title>cc65 function reference
5 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
9 cc65 is a C compiler for 6502 based systems. This function reference describes
10 the C functions available in the standard library.
13 <!-- Table of contents -->
16 <!-- Begin the document -->
20 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
21 C standard plus additional functions specially crafted for 6502 systems or
22 just some of the supported machines. This function refrence describes the
23 available functions together with any limitations.
25 For an overview about the available libraries, their purpose, and any
26 differences to the ISO standard, please have a look at the <url
27 url="library.html" name="cc65 Library Overview">.
29 <em/Note:/ Standard C functions are listed here, but not described in detail.
30 Since these functions behave identical on all standard compliant systems, they
31 are described in any book covering standard C.
33 Each entry for a function contains a detailed description
37 <tag/Function/Summary of what <bf/function/ does.
38 <tag/Header/The header file that contains the declaration.
39 <tag/Declaration/Describes the needed header files and declaration of the
41 <tag/Description/Description of the function.
42 <tag/Notes/Notes on the function.
43 <tag/Availability/The availability of the function.
44 <tag/See also/Other related functions.
45 <tag/Example/A piece of actual code using the function.
50 <sect>Functions by header file<p>
52 <sect1><tt/6502.h/<label id="6502.h"><p>
55 <item><ref id="BRK" name="BRK">
56 <item><ref id="CLI" name="CLI">
57 <item><ref id="SEI" name="SEI">
58 <item><ref id="_sys" name="_sys">
59 <item><ref id="getcpu" name="getcpu">
60 <item><ref id="reset_brk" name="reset_brk">
61 <item><ref id="reset_irq" name="reset_irq">
62 <item><ref id="set_brk" name="set_brk">
63 <item><ref id="set_irq" name="set_irq">
67 <sect1><tt/apple2.h/<label id="apple2.h"><p>
71 <item><ref id="get_ostype" name="get_ostype">
76 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
80 <item><ref id="get_ostype" name="get_ostype">
84 <item><ref id="videomode" name="videomode">
88 <sect1><tt/assert.h/<label id="assert.h"><p>
91 <item><ref id="assert" name="assert">
95 <sect1><tt/atari.h/<label id="atari.h"><p>
98 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
99 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
100 <!-- <item><ref id="_graphics" name="_graphics"> -->
101 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
102 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
103 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
104 <!-- <item><ref id="_scroll" name="_scroll"> -->
105 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
106 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
107 <item><ref id="get_ostype" name="get_ostype">
108 <!-- <item><ref id="get_tv" name="get_tv"> -->
114 <sect1><tt/atmos.h/<label id="atmos.h"><p>
117 <item><ref id="atmos_load" name="atmos_load">
118 <item><ref id="atmos_save" name="atmos_save">
119 <!-- <item><ref id="atmos_explode" name="atmos_explode"> -->
120 <!-- <item><ref id="atmos_ping" name="atmos_ping"> -->
121 <!-- <item><ref id="atmos_shoot" name="atmos_shoot"> -->
122 <!-- <item><ref id="atmos_tick" name="atmos_tick"> -->
123 <!-- <item><ref id="atmos_tock" name="atmos_tock"> -->
124 <!-- <item><ref id="atmos_zap" name="atmos_zap"> -->
130 <sect1><tt/c128.h/<label id="c128.h"><p>
133 <item><ref id="c64mode" name="c64mode">
134 <item><ref id="fast" name="fast">
135 <item><ref id="slow" name="slow">
136 <item><ref id="toggle_videomode" name="toggle_videomode">
137 <item><ref id="videomode" name="videomode">
141 <sect1><tt/c16.h/<label id="c16.h"><p>
146 <sect1><tt/c64.h/<label id="c64.h"><p>
149 <item><ref id="get_ostype" name="get_ostype">
153 <sect1><tt/cbm.h/<label id="cbm.h"><p>
156 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
157 <item><ref id="cbm_k_basin" name="cbm_k_basin">
158 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
159 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
160 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
161 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
162 <item><ref id="cbm_k_clall" name="cbm_k_clall">
163 <item><ref id="cbm_k_close" name="cbm_k_close">
164 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
165 <item><ref id="cbm_k_getin" name="cbm_k_getin">
166 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
167 <item><ref id="cbm_k_listen" name="cbm_k_listen">
168 <item><ref id="cbm_k_load" name="cbm_k_load">
169 <item><ref id="cbm_k_open" name="cbm_k_open">
170 <item><ref id="cbm_k_readst" name="cbm_k_readst">
171 <item><ref id="cbm_k_save" name="cbm_k_save">
172 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
173 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
174 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
175 <item><ref id="cbm_k_talk" name="cbm_k_talk">
176 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
177 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
178 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
179 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
180 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
181 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
182 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
183 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
184 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
185 <!-- <item><ref id="get_tv" name="get_tv"> -->
186 <item><ref id="kbrepeat" name="kbrepeat">
192 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
195 <item><ref id="peekbsys" name="peekbsys">
196 <item><ref id="peekwsys" name="peekwsys">
197 <item><ref id="pokebsys" name="pokebsys">
198 <item><ref id="pokewsys" name="pokewsys">
202 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
205 <item><ref id="peekbsys" name="peekbsys">
206 <item><ref id="peekwsys" name="peekwsys">
207 <item><ref id="pokebsys" name="pokebsys">
208 <item><ref id="pokewsys" name="pokewsys">
212 <sect1><tt/cc65.h/<label id="cc65.h"><p>
215 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
216 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
217 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
218 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
219 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
220 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
221 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
222 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
223 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
224 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
230 <sect1><tt/conio.h/<label id="conio.h"><p>
233 <item><ref id="bgcolor" name="bgcolor">
234 <item><ref id="bordercolor" name="bordercolor">
235 <item><ref id="cclear" name="cclear">
236 <item><ref id="cclearxy" name="cclearxy">
237 <item><ref id="cgetc" name="cgetc">
238 <item><ref id="chline" name="chline">
239 <item><ref id="chlinexy" name="chlinexy">
240 <item><ref id="clrscr" name="clrscr">
241 <item><ref id="cprintf" name="cprintf">
242 <item><ref id="cputc" name="cputc">
243 <item><ref id="cputcxy" name="cputcxy">
244 <item><ref id="cputs" name="cputs">
245 <item><ref id="cputsxy" name="cputsxy">
246 <item><ref id="cursor" name="cursor">
247 <item><ref id="cvline" name="cvline">
248 <item><ref id="cvlinexy" name="cvlinexy">
249 <item><ref id="gotox" name="gotox">
250 <item><ref id="gotoxy" name="gotoxy">
251 <item><ref id="gotoy" name="gotoy">
252 <item><ref id="kbhit" name="kbhit">
253 <item><ref id="revers" name="revers">
254 <item><ref id="screensize" name="screensize">
255 <item><ref id="textcolor" name="textcolor">
256 <item><ref id="vcprintf" name="vcprintf">
257 <item><ref id="wherex" name="wherex">
258 <item><ref id="wherey" name="wherey">
262 <sect1><tt/ctype.h/<label id="ctype.h"><p>
265 <item><ref id="isalnum" name="isalnum">
266 <item><ref id="isalpha" name="isalpha">
267 <item><ref id="isascii" name="isascii">
268 <item><ref id="isblank" name="isblank">
269 <item><ref id="iscntrl" name="iscntrl">
270 <item><ref id="isdigit" name="isdigit">
271 <item><ref id="isgraph" name="isgraph">
272 <item><ref id="islower" name="islower">
273 <item><ref id="isprint" name="isprint">
274 <item><ref id="ispunct" name="ispunct">
275 <item><ref id="isspace" name="isspace">
276 <item><ref id="isupper" name="isupper">
277 <item><ref id="isxdigit" name="isxdigit">
278 <item><ref id="tolower" name="tolower">
279 <item><ref id="toupper" name="toupper">
283 <sect1><tt/dbg.h/<label id="dbg.h"><p>
286 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
292 <sect1><tt/dio.h/<label id="dio.h"><p>
294 <url url="dio.html" name="Low-level disk I/O API">.
297 <sect1><tt/dirent.h/<label id="dirent.h"><p>
300 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
301 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
302 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
303 <item><ref id="_DE_ISREG" name="_DE_ISREG">
304 <item><ref id="closedir" name="closedir">
305 <item><ref id="opendir" name="opendir">
306 <item><ref id="readdir" name="readdir">
307 <item><ref id="rewinddir" name="rewinddir">
308 <item><ref id="seekdir" name="seekdir">
309 <item><ref id="telldir" name="telldir">
315 <sect1><tt/em.h/<label id="em.h"><p>
318 <item><ref id="em_commit" name="em_commit">
319 <item><ref id="em_copyfrom" name="em_copyfrom">
320 <item><ref id="em_copyto" name="em_copyto">
321 <item><ref id="em_install" name="em_install">
322 <item><ref id="em_load_driver" name="em_load_driver">
323 <item><ref id="em_map" name="em_map">
324 <item><ref id="em_pagecount" name="em_pagecount">
325 <item><ref id="em_uninstall" name="em_uninstall">
326 <item><ref id="em_unload" name="em_unload">
327 <item><ref id="em_use" name="em_use">
331 <sect1><tt/errno.h/<label id="errno.h"><p>
334 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
335 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
336 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
337 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
343 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
346 <item><ref id="close" name="close">
347 <item><ref id="creat" name="creat">
348 <item><ref id="open" name="open">
352 <sect1><tt/gamate.h/<label id="gamate.h"><p>
355 <!-- <item><ref id="get_tv" name="get_tv"> -->
356 <!-- <item><ref id="waitvblank" name="waitvblank"> -->
362 <sect1><tt/geos.h/<label id="geos.h"><p>
367 <sect1><tt/joystick.h/<label id="joystick.h"><p>
370 <item><ref id="joy_count" name="joy_count">
371 <item><ref id="joy_install" name="joy_install">
372 <item><ref id="joy_load_driver" name="joy_load_driver">
373 <item><ref id="joy_read" name="joy_read">
374 <item><ref id="joy_uninstall" name="joy_uninstall">
375 <item><ref id="joy_unload" name="joy_unload">
379 <sect1><tt/locale.h/<label id="locale.h"><p>
382 <item><ref id="localeconv" name="localeconv">
383 <item><ref id="setlocale" name="setlocale">
387 <sect1><tt/lynx.h/<label id="lynx.h"><p>
390 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
391 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
392 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
393 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
394 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
395 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
396 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
402 <sect1><tt/lz4.h/<label id="lz4.h"><p>
405 <item><ref id="decompress_lz4" name="decompress_lz4">
409 <sect1><tt/modload.h/<label id="modload.h"><p>
412 <item><ref id="mod_load" name="mod_load">
413 <item><ref id="mod_free" name="mod_free">
417 <sect1><tt/mouse.h/<label id="mouse.h"><p>
420 <item><ref id="mouse_buttons" name="mouse_buttons">
421 <item><ref id="mouse_getbox" name="mouse_getbox">
422 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
423 <item><ref id="mouse_hide" name="mouse_hide">
424 <item><ref id="mouse_info" name="mouse_info">
425 <item><ref id="mouse_install" name="mouse_install">
426 <item><ref id="mouse_ioctl" name="mouse_ioctl">
427 <item><ref id="mouse_load_driver" name="mouse_load_driver">
428 <item><ref id="mouse_move" name="mouse_move">
429 <item><ref id="mouse_pos" name="mouse_pos">
430 <item><ref id="mouse_setbox" name="mouse_setbox">
431 <item><ref id="mouse_show" name="mouse_show">
432 <item><ref id="mouse_uninstall" name="mouse_uninstall">
433 <item><ref id="mouse_unload" name="mouse_unload">
437 <sect1><tt/nes.h/<label id="nes.h"><p>
440 <!-- <item><ref id="get_tv" name="get_tv"> -->
441 <!-- <item><ref id="waitvsync" name="waitvsync"> -->
447 <sect1><tt/o65.h/<label id="o65.h"><p>
449 The <tt/o65.h/ header file contains structure and constant definitions that
450 may be used when dealing with files in <url
451 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
452 It does not declare any functions.
455 <sect1><tt/pce.h/<label id="pce.h"><p>
458 <!-- <item><ref id="get_tv" name="get_tv"> -->
459 <!-- <item><ref id="waitvblank" name="waitvblank"> -->
465 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
468 <item><ref id="PEEK" name="PEEK">
469 <item><ref id="PEEKW" name="PEEKW">
470 <item><ref id="POKE" name="POKE">
471 <item><ref id="POKEW" name="POKEW">
475 <sect1><tt/pen.h/<label id="pen.h"><p>
478 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
479 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
485 <sect1><tt/pet.h/<label id="pet.h"><p>
490 <sect1><tt/plus4.h/<label id="plus4.h"><p>
495 <sect1><tt/serial.h/<label id="serial.h"><p>
497 The <tt/serial.h/ header file contains definitions for initializing serial
501 <item><ref id="ser_close" name="ser_close">
502 <item><ref id="ser_get" name="ser_get">
503 <item><ref id="ser_install" name="ser_install">
504 <item><ref id="ser_ioctl" name="ser_ioctl">
505 <item><ref id="ser_load_driver" name="ser_load_driver">
506 <item><ref id="ser_open" name="ser_open">
507 <item><ref id="ser_put" name="ser_put">
508 <item><ref id="ser_status" name="ser_status">
509 <item><ref id="ser_uninstall" name="ser_uninstall">
510 <item><ref id="ser_unload" name="ser_unload">
514 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
517 <item><ref id="setjmp" name="setjmp">
518 <item><ref id="longjmp" name="longjmp">
522 <sect1><tt/signal.h/<label id="signal.h"><p>
525 <item><ref id="raise" name="raise">
526 <item><ref id="signal" name="signal">
530 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
535 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
540 <sect1><tt/stddef.h/<label id="stddef.h"><p>
543 <item><ref id="offsetof" name="offsetof">
547 <sect1><tt/stdio.h/<label id="stdio.h"><p>
550 <item><ref id="_poserror" name="_poserror">
551 <item><ref id="clearerr" name="clearerr">
552 <!-- <item><ref id="fclose" name="fclose"> -->
553 <!-- <item><ref id="fdopen" name="fdopen"> -->
554 <item><ref id="feof" name="feof">
555 <item><ref id="ferror" name="ferror">
556 <!-- <item><ref id="fflush" name="fflush"> -->
557 <!-- <item><ref id="fgetc" name="fgetc"> -->
558 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
559 <!-- <item><ref id="fgets" name="fgets"> -->
560 <item><ref id="fileno" name="fileno">
561 <!-- <item><ref id="fopen" name="fopen"> -->
562 <!-- <item><ref id="fprintf" name="fprintf"> -->
563 <!-- <item><ref id="fputc" name="fputc"> -->
564 <!-- <item><ref id="fputs" name="fputs"> -->
565 <!-- <item><ref id="fread" name="fread"> -->
566 <!-- <item><ref id="freopen" name="freopen"> -->
567 <!-- <item><ref id="fscanf" name="fscanf"> -->
568 <!-- <item><ref id="fseek" name="fseek"> -->
569 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
570 <!-- <item><ref id="ftell" name="ftell"> -->
571 <!-- <item><ref id="fwrite" name="fwrite"> -->
572 <!-- <item><ref id="getc" name="getc"> -->
573 <!-- <item><ref id="getchar" name="getchar"> -->
574 <!-- <item><ref id="gets" name="gets"> -->
575 <!-- <item><ref id="printf" name="printf"> -->
576 <!-- <item><ref id="putc" name="putc"> -->
577 <!-- <item><ref id="putchar" name="putchar"> -->
578 <!-- <item><ref id="puts" name="puts"> -->
579 <item><ref id="rename" name="rename">
580 <item><ref id="remove" name="remove">
581 <!-- <item><ref id="rewind" name="rewind"> -->
582 <!-- <item><ref id="scanf" name="scanf"> -->
583 <!-- <item><ref id="snprintf" name="snprintf"> -->
584 <!-- <item><ref id="sprintf" name="sprintf"> -->
585 <!-- <item><ref id="sscanf" name="sscanf"> -->
586 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
587 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
588 <!-- <item><ref id="vprintf" name="vprintf"> -->
589 <!-- <item><ref id="vscanf" name="vscanf"> -->
590 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
591 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
592 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
598 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
601 <item><ref id="_heapadd" name="_heapadd">
602 <item><ref id="_heapblocksize" name="_heapblocksize">
603 <item><ref id="_heapmaxavail" name="_heapmaxavail">
604 <item><ref id="_heapmemavail" name="_heapmemavail">
605 <item><ref id="_randomize" name="_randomize">
606 <item><ref id="_swap" name="_swap">
607 <item><ref id="abort" name="abort">
608 <item><ref id="abs" name="abs">
609 <item><ref id="atexit" name="atexit">
610 <item><ref id="atoi" name="atoi">
611 <item><ref id="atol" name="atol">
612 <item><ref id="bsearch" name="bsearch">
613 <item><ref id="calloc" name="calloc">
614 <item><ref id="div" name="div">
615 <item><ref id="exit" name="exit">
616 <item><ref id="free" name="free">
617 <item><ref id="getenv" name="getenv">
618 <item><ref id="itoa" name="itoa">
619 <item><ref id="labs" name="labs">
620 <item><ref id="ltoa" name="ltoa">
621 <item><ref id="malloc" name="malloc">
622 <item><ref id="perror" name="perror">
623 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
624 <!-- <item><ref id="putenv" name="putenv"> -->
625 <item><ref id="qsort" name="qsort">
626 <item><ref id="rand" name="rand">
627 <item><ref id="realloc" name="realloc">
628 <item><ref id="srand" name="srand">
629 <!-- <item><ref id="system" name="system"> -->
630 <item><ref id="ultoa" name="ultoa">
631 <item><ref id="utoa" name="utoa">
637 <sect1><tt/string.h/<label id="string.h"><p>
640 <item><ref id="_stroserror" name="_stroserror">
641 <item><ref id="bzero" name="bzero">
642 <item><ref id="memchr" name="memchr">
643 <item><ref id="memcmp" name="memcmp">
644 <item><ref id="memcpy" name="memcpy">
645 <item><ref id="memmove" name="memmove">
646 <item><ref id="memset" name="memset">
647 <item><ref id="strcasecmp" name="strcasecmp">
648 <item><ref id="strcat" name="strcat">
649 <item><ref id="strchr" name="strchr">
650 <item><ref id="strcmp" name="strcmp">
651 <item><ref id="strcoll" name="strcoll">
652 <item><ref id="strcpy" name="strcpy">
653 <item><ref id="strcspn" name="strcspn">
654 <item><ref id="strdup" name="strdup">
655 <item><ref id="strerror" name="strerror">
656 <item><ref id="stricmp" name="stricmp">
657 <item><ref id="strlen" name="strlen">
658 <item><ref id="strlower" name="strlower">
659 <item><ref id="strlwr" name="strlwr">
660 <item><ref id="strncat" name="strncat">
661 <item><ref id="strncmp" name="strncmp">
662 <item><ref id="strncpy" name="strncpy">
663 <item><ref id="strqtok" name="strqtok">
664 <item><ref id="strrchr" name="strrchr">
665 <item><ref id="strspn" name="strspn">
666 <item><ref id="strstr" name="strstr">
667 <item><ref id="strtok" name="strtok">
668 <item><ref id="strxfrm" name="strxfrm">
669 <item><ref id="strupper" name="strupper">
670 <item><ref id="strupr" name="strupr">
676 <sect1><tt/tgi.h/<label id="tgi.h"><p>
679 <item><ref id="tgi_arc" name="tgi_arc">
680 <item><ref id="tgi_bar" name="tgi_bar">
681 <item><ref id="tgi_circle" name="tgi_circle">
682 <item><ref id="tgi_clear" name="tgi_clear">
683 <item><ref id="tgi_done" name="tgi_done">
684 <item><ref id="tgi_ellipse" name="tgi_ellipse">
685 <item><ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
686 <item><ref id="tgi_getaspectratio" name="tgi_getaspectratio">
687 <item><ref id="tgi_getcolor" name="tgi_getcolor">
688 <item><ref id="tgi_getcolorcount" name="tgi_getcolorcount">
689 <item><ref id="tgi_getdefpalette" name="tgi_getdefpalette">
690 <item><ref id="tgi_geterror" name="tgi_geterror">
691 <item><ref id="tgi_geterrormsg" name="tgi_geterrormsg">
692 <item><ref id="tgi_getmaxcolor" name="tgi_getmaxcolor">
693 <item><ref id="tgi_getmaxx" name="tgi_getmaxx">
694 <item><ref id="tgi_getmaxy" name="tgi_getmaxy">
695 <item><ref id="tgi_getpagecount" name="tgi_getpagecount">
696 <item><ref id="tgi_getpalette" name="tgi_getpalette">
697 <item><ref id="tgi_getpixel" name="tgi_getpixel">
698 <item><ref id="tgi_gettextheight" name="tgi_gettextheight">
699 <item><ref id="tgi_gettextwidth" name="tgi_gettextwidth">
700 <item><ref id="tgi_getxres" name="tgi_getxres">
701 <item><ref id="tgi_getyres" name="tgi_getyres">
702 <item><ref id="tgi_gotoxy" name="tgi_gotoxy">
703 <item><ref id="tgi_init" name="tgi_init">
704 <item><ref id="tgi_install" name="tgi_install">
705 <item><ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
706 <item><ref id="tgi_ioctl" name="tgi_ioctl">
707 <item><ref id="tgi_line" name="tgi_line">
708 <item><ref id="tgi_lineto" name="tgi_lineto">
709 <item><ref id="tgi_load_driver" name="tgi_load_driver">
710 <item><ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">
711 <item><ref id="tgi_outtext" name="tgi_outtext">
712 <item><ref id="tgi_outtextxy" name="tgi_outtextxy">
713 <item><ref id="tgi_setaspectratio" name="tgi_setaspectratio">
714 <item><ref id="tgi_setcolor" name="tgi_setcolor">
715 <item><ref id="tgi_setdrawpage" name="tgi_setdrawpage">
716 <item><ref id="tgi_setpalette" name="tgi_setpalette">
717 <item><ref id="tgi_setpixel" name="tgi_setpixel">
718 <item><ref id="tgi_setviewpage" name="tgi_setviewpage">
719 <item><ref id="tgi_settextscale" name="tgi_settextscale">
720 <item><ref id="tgi_settextstyle" name="tgi_settextstyle">
721 <item><ref id="tgi_uninstall" name="tgi_uninstall">
722 <item><ref id="tgi_unload" name="tgi_unload">
725 <sect1><tt/time.h/<label id="time.h"><p>
728 <!-- <item><ref id="_systime" name="_systime"> -->
729 <!-- <item><ref id="asctime" name="asctime"> -->
730 <item><ref id="clock" name="clock">
731 <!-- <item><ref id="ctime" name="ctime"> -->
732 <!-- <item><ref id="gmtime" name="gmtime"> -->
733 <!-- <item><ref id="localtime" name="localtime"> -->
734 <!-- <item><ref id="mktime" name="mktime"> -->
735 <!-- <item><ref id="strftime" name="strftime"> -->
736 <item><ref id="time" name="time">
742 <sect1><tt/unistd.h/<label id="unistd.h"><p>
745 <!-- <item><ref id="chdir" name="chdir"> -->
746 <item><ref id="exec" name="exec">
747 <!-- <item><ref id="getcwd" name="getcwd"> -->
748 <item><ref id="getopt" name="getopt">
749 <!-- <item><ref id="lseek" name="lseek"> -->
750 <!-- <item><ref id="mkdir" name="mkdir"> -->
751 <!-- <item><ref id="read" name="read"> -->
752 <!-- <item><ref id="rmdir" name="rmdir"> -->
753 <item><ref id="sleep" name="sleep">
754 <item><ref id="unlink" name="unlink">
755 <!-- <item><ref id="write" name="write"> -->
761 <sect1><tt/vic20.h/<label id="vic20.h"><p>
766 <sect1><tt/zlib.h/<label id="zlib.h"><p>
769 <!-- <item><ref id="adler32" name="adler32"> -->
770 <!-- <item><ref id="crc32" name="crc32"> -->
771 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
772 <!-- <item><ref id="uncompress" name="uncompress"> -->
778 <sect>Alphabetical function reference<p>
780 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
784 <tag/Function/Determine if a directory entry specifies a directory.
785 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
786 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
787 <tag/Description/The function is called with the type of a directory entry
788 taken from a <tt/struct dirent/ and returns true if the entry designates
791 <item>The function is actually a macro.
793 <tag/Availability/cc65
795 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
796 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
797 <ref id="_DE_ISREG" name="_DE_ISREG">
803 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
807 <tag/Function/Determine if a directory entry specifies a disk label.
808 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
809 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
810 <tag/Description/The function is called with the type of a directory entry
811 taken from a <tt/struct dirent/ and returns true if the entry designates
814 <item>The function is actually a macro.
816 <tag/Availability/cc65
818 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
819 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
820 <ref id="_DE_ISREG" name="_DE_ISREG">
826 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
830 <tag/Function/Determine if a directory entry specifies a link.
831 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
832 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
833 <tag/Description/The function is called with the type of a directory entry
834 taken from a <tt/struct dirent/ and returns true if the entry designates
837 <item>The function is actually a macro.
839 <tag/Availability/cc65
841 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
842 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
843 <ref id="_DE_ISREG" name="_DE_ISREG">
849 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
853 <tag/Function/Determine if a directory entry specifies a regular file.
854 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
855 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
856 <tag/Description/The function is called with the type of a directory entry
857 taken from a <tt/struct dirent/ and returns true if the entry designates
860 <item>The function is actually a macro.
861 <item>A "regular file" means anything with data in it. This might still mean
862 that special processing is needed, when accessing the file. Relative files of
863 the CBM systems are classified as being "regular" files, for example.
865 <tag/Availability/cc65
867 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
868 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
869 <ref id="_DE_ISLNK" name="_DE_ISLNK">
875 <sect1>_heapadd<label id="_heapadd"><p>
879 <tag/Function/Add a block to the heap.
880 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
881 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
882 <tag/Description/The function adds a block of raw memory to the heap.
884 <item>The minimum blocksize that can be added is 6 bytes; the function will
885 ignore smaller blocks.
886 <item>The function is available only as a fastcall function; so, it may be used
887 only in the presence of a prototype.
889 <tag/Availability/cc65
891 <ref id="_heapblocksize" name="_heapblocksize">,
892 <ref id="_heapmaxavail" name="_heapmaxavail">,
893 <ref id="_heapmemavail" name="_heapmemavail">,
894 <ref id="calloc" name="calloc">,
895 <ref id="free" name="free">,
896 <ref id="malloc" name="malloc">,
897 <ref id="realloc" name="realloc">
903 <sect1>_heapblocksize<label id="_heapblocksize"><p>
907 <tag/Function/Return the size of an allocated block.
908 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
909 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
910 <tag/Description/The function returns the size of a block that must have
911 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
912 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
914 <item>Passing a pointer to a block that was is not the result of one of the
915 allocation functions, or that has been free'd will give unpredicable results.
916 <item>The function is available only as a fastcall function; so, it may be used
917 only in the presence of a prototype.
919 <tag/Availability/cc65
921 <ref id="_heapadd" name="_heapadd">,
922 <ref id="_heapmaxavail" name="_heapmaxavail">,
923 <ref id="_heapmemavail" name="_heapmemavail">,
924 <ref id="calloc" name="calloc">,
925 <ref id="free" name="free">,
926 <ref id="malloc" name="malloc">,
927 <ref id="realloc" name="realloc">
933 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
937 <tag/Function/Return the largest block that is available on the heap.
938 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
939 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
940 <tag/Description/The function returns the size of the largest block that may
941 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
942 <tag/Availability/cc65
944 <ref id="_heapadd" name="_heapadd">,
945 <ref id="_heapblocksize" name="_heapblocksize">,
946 <ref id="_heapmemavail" name="_heapmemavail">,
947 <ref id="calloc" name="calloc">,
948 <ref id="free" name="free">,
949 <ref id="malloc" name="malloc">,
950 <ref id="realloc" name="realloc">
956 <sect1>_heapmemavail<label id="_heapmemavail"><p>
960 <tag/Function/Return the total available space on the heap.
961 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
962 <tag/Declaration/<tt/size_t _heapmemavail (void);/
963 <tag/Description/The function returns the total number of bytes available on
966 <item>This function is of less use than usually assumed, since the returned
967 heap space may be available but not in one block. So even if this function
968 says that several times more heap space is available than needed, <ref
969 id="malloc" name="malloc"> may still return <tt/NULL/.
971 <tag/Availability/cc65
973 <ref id="_heapadd" name="_heapadd">,
974 <ref id="_heapblocksize" name="_heapblocksize">,
975 <ref id="_heapmaxavail" name="_heapmaxavail">,
976 <ref id="calloc" name="calloc">,
977 <ref id="free" name="free">,
978 <ref id="malloc" name="malloc">,
979 <ref id="realloc" name="realloc">
985 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
989 <tag/Function/Determines whether the underlying DOS supports command line arguments.
990 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
991 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
992 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
993 It returns 1 if it does.
994 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
999 <sect1>_poserror<label id="_poserror"><p>
1003 <tag/Function/Print an error message for the error in <tt/_oserror/.
1004 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1005 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1006 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1007 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1008 a colon and a blank. Then the error message for the current contents of
1009 <tt/_oserror/ are printed followed by a newline. The message output is the
1010 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1011 argument of <tt/_oserror/.
1012 <tag/Notes/<itemize>
1013 <item>Since operating system specific error code are - you guessed it -
1014 operating system specific, the value in <tt/_oserror/ and the message that is
1015 printed depends on the cc65 target.
1016 <item>The function is only available as fastcall function, so it may only
1017 be used in presence of a prototype.
1019 <tag/Availability/cc65
1021 <ref id="_stroserror" name="_stroserror">,
1022 <ref id="perror" name="perror">
1028 <sect1>_randomize<label id="_randomize"><p>
1032 <tag/Function/Initialize the pseudo random number generator.
1033 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1034 <tag/Declaration/<tt/void _randomize (void);/
1035 <tag/Description/The function initializes the random number generator with
1036 a seed derived from fast changing hardware events, so the seed itself can be
1037 considered random to a certain degree.
1038 <tag/Notes/<itemize>
1039 <item>The randomness of the seed depends on the machine hardware.
1041 <tag/Availability/cc65
1043 <ref id="rand" name="rand">,
1044 <ref id="srand" name="srand">
1050 <sect1>_stroserror<label id="_stroserror"><p>
1054 <tag/Function/Return a string describing an OS specific error code.
1055 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1056 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1057 <tag/Description/<tt/_stroserror/ will return a string describing the given
1058 operating system specific error code.
1059 <tag/Notes/<itemize>
1060 <item>Since operating system specific error code are - you guessed it -
1061 operating system specific, the parameter and the string returned depend on the
1063 <item>The function is only available as fastcall function, so it may only be
1064 used in presence of a prototype.
1066 <tag/Availability/cc65
1068 <ref id="strerror" name="strerror">
1074 <sect1>_swap<label id="_swap"><p>
1078 <tag/Function/Swap the contents of memory areas.
1079 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1080 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1081 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1082 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1083 <tt/size/ bytes in size.
1084 <tag/Notes/<itemize>
1085 <item>The memory areas may not overlap, otherwise the results are undefined.
1086 <item>The function is only available as fastcall function, so it may only be
1087 used in presence of a prototype.
1089 <tag/Availability/cc65
1091 <ref id="memcpy" name="memcpy">,
1092 <ref id="memmove" name="memmove">
1098 <sect1>_sys<label id="_sys"><p>
1102 <tag/Function/Call a subroutine passing register values.
1103 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1104 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1105 <tag/Description/The function will call the subroutine at the address
1106 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1107 registers and the CPU flags are set to the values given in the <tt/regs/
1108 structure. On return from the subroutine, the new values of the registers and
1109 flags are stored back overwriting the old values.
1110 <tag/Notes/<itemize>
1111 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1112 when calling the subroutine (they are unchanged from their current values).
1113 <item>The function is only available as fastcall function, so it may only be
1114 used in presence of a prototype.
1116 <tag/Availability/cc65
1122 <sect1>BRK<label id="BRK"><p>
1126 <tag/Function/Insert a 6502 BRK instrunction into the code.
1127 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1128 <tag/Declaration/<tt/void BRK (void);/
1129 <tag/Description/The function will insert a 6502 BRK instruction into the code
1130 which may be used to trigger a debugger.
1131 <tag/Notes/<itemize>
1132 <item>The function is actually a macro.
1133 <item>The inserted instruction may lead to unexpected results if no debugger
1136 <tag/Availability/cc65
1138 <ref id="CLI" name="CLI">,
1139 <ref id="SEI" name="SEI">
1145 <sect1>CLI<label id="CLI"><p>
1149 <tag/Function/Insert a 6502 CLI instrunction into the code.
1150 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1151 <tag/Declaration/<tt/void CLI (void);/
1152 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1153 so interrupts are enabled. Enabling interrupts has no effects if they are
1154 already enabled (the default).
1155 <tag/Notes/<itemize>
1156 <item>The function is actually a macro.
1157 <item>Disabling interrupts may lead to unexpected results.
1159 <tag/Availability/cc65
1161 <ref id="BRK" name="BRK">,
1162 <ref id="SEI" name="SEI">
1168 <sect1>PEEK<label id="PEEK"><p>
1172 <tag/Function/Read a byte from memory.
1173 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1174 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1175 <tag/Description/The function will read the absolute memory given by <tt/addr/
1176 and return the value read.
1177 <tag/Notes/<itemize>
1178 <item>The function is actually a macro.
1179 <item>This function depends highly on the platform and environment.
1181 <tag/Availability/cc65
1183 <ref id="PEEKW" name="PEEKW">,
1184 <ref id="POKE" name="POKE">
1190 <sect1>PEEKW<label id="PEEKW"><p>
1194 <tag/Function/Read a word (two bytes) from memory.
1195 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1196 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1197 <tag/Description/The function will read the absolute memory given by <tt/addr/
1198 and return the value read. The byte read from the higher address is the high
1199 byte of the return value.
1200 <tag/Notes/<itemize>
1201 <item>The function is actually a macro.
1202 <item>This function depends highly on the platform and environment.
1203 <item>The order in which the two bytes are read is unspecified and may
1204 depend of the address expression used.
1206 <tag/Availability/cc65
1208 <ref id="PEEK" name="PEEK">,
1209 <ref id="POKE" name="POKE">
1215 <sect1>POKE<label id="POKE"><p>
1219 <tag/Function/Write a byte to memory.
1220 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1221 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1222 <tag/Description/The function writes the value <tt/val/ to the absolute
1223 memory address given by <tt/addr/.
1224 <tag/Notes/<itemize>
1225 <item>The function is actually a macro.
1226 <item>This function depends highly on the platform and environment.
1227 <item>Careless use will cause the program to act strange or may crash the
1230 <tag/Availability/cc65
1232 <ref id="PEEK" name="PEEK">,
1233 <ref id="POKEW" name="POKEW">
1239 <sect1>POKEW<label id="POKEW"><p>
1243 <tag/Function/Write a word (two bytes) to memory.
1244 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1245 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1246 <tag/Description/The function writes the value <tt/val/ to the absolute
1247 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1248 the <tt/addr/, the high byte is written to <tt/addr+1/.
1249 <tag/Notes/<itemize>
1250 <item>The function is actually a macro.
1251 <item>This function depends highly on the platform and environment.
1252 <item>Careless use will cause the program to act strange or may crash the
1254 <item>The order in which the two bytes are written is unspecified and may
1255 depend of the address expression used.
1257 <tag/Availability/cc65
1259 <ref id="PEEK" name="PEEK">,
1260 <ref id="POKE" name="POKE">
1266 <sect1>SEI<label id="SEI"><p>
1270 <tag/Function/Insert a 6502 SEI instrunction into the code.
1271 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1272 <tag/Declaration/<tt/void SEI (void);/
1273 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1274 so interrupts are disabled. Note that non maskable interrupts cannot be
1276 <tag/Notes/<itemize>
1277 <item>The function is actually a macro.
1278 <item>Disabling interrupts may lead to unexpected results.
1280 <tag/Availability/cc65
1282 <ref id="BRK" name="BRK">,
1283 <ref id="CLI" name="CLI">
1289 <sect1>abort<label id="abort"><p>
1293 <tag/Function/Terminates a program abnormally.
1294 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1295 <tag/Declaration/<tt/void abort (void);/
1296 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1297 on stderr, then terminates the program with an exit code of 3.
1298 <tag/Availability/ISO 9899
1300 <ref id="assert" name="assert">,
1301 <ref id="exit" name="exit">,
1302 <ref id="raise" name="raise">
1308 <sect1>abs<label id="abs"><p>
1312 <tag/Function/Returns the absolute value of an integer.
1313 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1314 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1315 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1317 <tag/Notes/<itemize>
1318 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1319 <item>The function is only available as fastcall function, so it may only be
1320 used in presence of a prototype.
1322 <tag/Availability/ISO 9899
1324 <ref id="labs" name="labs">
1330 <sect1>assert<label id="assert"><p>
1334 <tag/Function/Test a condition and possibly abort.
1335 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1336 <tag/Declaration/<tt/void assert (int cond);/
1337 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1338 statement. If the condition evaluates t zero (false), assert prints a message
1339 on stderr and aborts the program.
1340 <tag/Notes/<itemize>
1341 <item>The function is actually a macro.
1343 <tag/Availability/ISO 9899
1345 <ref id="abort" name="abort">,
1346 <ref id="exit" name="exit">
1352 <sect1>atexit<label id="atexit"><p>
1356 <tag/Function/Register an exit function.
1357 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1358 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1359 <tag/Description/<tt/atexit/ registers the function pointed to by
1360 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1361 terminates, they are called in LIFO order (the last function registered is
1362 called first). <tt/atexit/ returns zero on success and a nonzero value on
1364 <tag/Notes/<itemize>
1365 <item>A maximum of 5 exit functions can be registered.
1366 <item>There is no way to unregister an exit function.
1367 <item>The function is only available as fastcall function, so it may only be
1368 used in presence of a prototype.
1370 <tag/Availability/ISO 9899
1372 <ref id="abort" name="abort">,
1373 <ref id="exit" name="exit">
1379 <sect1>atmos_load<label id="atmos_load"><p>
1383 <tag/Function/Load Atmos tape.
1384 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1385 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1386 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1387 <tag/Notes/<itemize>
1388 <item>The function is available only as a fastcall function; so, it may be used
1389 only in the presence of a prototype.
1391 <tag/Availability/cc65
1393 <ref id="atmos_save" name="atmos_save">
1399 <sect1>atmos_save<label id="atmos_save"><p>
1403 <tag/Function/Save Atmos tape.
1404 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1405 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1406 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1407 <tag/Notes/<itemize>
1408 <item>The function is available only as a fastcall function; so, it may be used
1409 only in the presence of a prototype.
1411 <tag/Availability/cc65
1413 <ref id="atmos_load" name="atmos_load">
1415 atmos_save("hires", 0xa000, 0xc000);
1421 <sect1>atoi<label id="atoi"><p>
1425 <tag/Function/Convert a string to an integer.
1426 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1427 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1428 <tag/Description/<tt/atoi/ converts the given string into an integer.
1429 Conversion stops as soon as any invalid character is encountered.
1430 <tag/Notes/<itemize>
1431 <item>There is no way to detect any conversion errors.
1432 <item>The function does not check for an numerical overflow when converting.
1433 <item>The function is only available as fastcall function, so it may only be
1434 used in presence of a prototype.
1436 <tag/Availability/ISO 9899
1438 <ref id="atol" name="atol">,
1439 <ref id="itoa" name="itoa">,
1440 <ref id="ltoa" name="ltoa">,
1441 <ref id="ultoa" name="ultoa">,
1442 <ref id="utoa" name="utoa">
1448 <sect1>atol<label id="atol"><p>
1452 <tag/Function/Convert a string to a long integer.
1453 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1454 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1455 <tag/Description/<tt/atol/ converts the given string into a long integer.
1456 Conversion stops as soon as any invalid character is encountered.
1457 <tag/Notes/<itemize>
1458 <item>There is no way to detect any conversion errors.
1459 <item>The function does not check for an numerical overflow when converting.
1460 <item>The function is only available as fastcall function, so it may only be
1461 used in presence of a prototype.
1463 <tag/Availability/ISO 9899
1465 <ref id="atoi" name="atoi">,
1466 <ref id="itoa" name="itoa">,
1467 <ref id="ltoa" name="ltoa">,
1468 <ref id="ultoa" name="ultoa">,
1469 <ref id="utoa" name="utoa">
1475 <sect1>bgcolor<label id="bgcolor"><p>
1479 <tag/Function/Set the background text color.
1480 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1481 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1482 <tag/Description/The function will set a new background color and return the
1483 old (current) one. The background color is valid for the whole text output
1484 area of the screen, not just for new text.
1485 <tag/Notes/<itemize>
1486 <item>Background colors are system dependent. The function may have no effect
1487 on systems where the background color cannot be changed.
1488 <item>The function is only available as fastcall function, so it may only be
1489 used in presence of a prototype.
1491 <tag/Availability/cc65
1493 <ref id="bordercolor" name="bordercolor">,
1494 <ref id="textcolor" name="textcolor">
1500 <sect1>bordercolor<label id="bordercolor"><p>
1504 <tag/Function/Set the border (frame) color.
1505 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1506 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1507 <tag/Description/The function will set a new border color. It returns the old
1508 (current) border color.
1509 <tag/Notes/<itemize>
1510 <item>Border colors are system dependent. The function may have no effect
1511 on systems where the border color cannot be changed.
1512 <item>The function is only available as fastcall function, so it may only
1513 be used in presence of a prototype.
1515 <tag/Availability/cc65
1517 <ref id="bgcolor" name="bgcolor">,
1518 <ref id="textcolor" name="textcolor">
1524 <sect1>bsearch<label id="bsearch"><p>
1528 <tag/Function/Do a binary search in a sorted array.
1529 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1530 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1531 const void* base, size_t n, size_t size,
1532 int __fastcall__ (* cmp) (const void*, const void*));/
1533 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1534 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1535 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1536 the function used to compare the members against the key. The function returns
1537 a pointer to the member found, or <tt/NULL/ if there was no match.
1538 <tag/Notes/<itemize>
1539 <item>The contents of the array must be sorted in ascending order according to
1540 the compare function given.
1541 <item>If there are multiple members that match the key, the function will
1542 return one of the members.
1543 <item>The function is only available as fastcall function, so it may only
1544 be used in presence of a prototype.
1545 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1548 <tag/Availability/ISO 9899
1550 <ref id="qsort" name="qsort">
1556 <sect1>bzero<label id="bzero"><p>
1560 <tag/Function/Fill a memory area with zeroes.
1561 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1562 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1563 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1565 <tag/Notes/<itemize>
1566 <item>The function is non standard and therefore only available in non ANSI
1567 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1568 <item>The function is only available as fastcall function, so it may only
1569 be used in presence of a prototype.
1571 <tag/Availability/cc65
1573 <ref id="_swap" name="_swap">,
1574 <ref id="memcpy" name="memcpy">,
1575 <ref id="memmove" name="memmove">,
1576 <ref id="memset" name="memset">,
1582 <sect1>c64mode<label id="c64mode"><p>
1586 <tag/Function/Switch the C128 into C64 compatible mode.
1587 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1588 <tag/Declaration/<tt/void c64mode (void);/
1589 <tag/Description/The function will cause the machine to reboot into C64 mode.
1590 <tag/Notes/<itemize>
1591 <item>The function is specific to the C128.
1592 <item>The function will not return to the caller.
1594 <tag/Availability/C128
1600 <sect1>calloc<label id="calloc"><p>
1604 <tag/Function/Allocate and clear memory.
1605 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1606 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1607 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1608 of size <tt/size/, clears the whole block with binary zeroes and returns a
1609 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1611 <tag/Notes/<itemize>
1612 <item>Clearing the memory may not have the expected effect on all platforms:
1613 pointers in the block may not be <tt/NULL/ and floating point variables may
1614 not be zero (0.0). In other words: The "clearing" effect of this function
1615 should be used with care for portable programs.
1616 <item>The function is only available as fastcall function, so it may only
1617 be used in presence of a prototype.
1619 <tag/Availability/ISO 9899
1621 <ref id="_heapadd" name="_heapadd">,
1622 <ref id="_heapblocksize" name="_heapblocksize">,
1623 <ref id="_heapmaxavail" name="_heapmaxavail">,
1624 <ref id="_heapmemavail" name="_heapmemavail">,
1625 <ref id="free" name="free">,
1626 <ref id="malloc" name="malloc">,
1627 <ref id="realloc" name="realloc">
1633 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1637 <tag/Function/Input byte from serial bus
1638 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1639 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1640 <tag/Description/The function returns a byte of data, which it
1641 gets from the current TALKer on the serial bus.
1642 In order to receive the data, the device must have previously been
1643 sent a command to TALK and a secondary address if it needs one.
1644 <tag/Notes/<itemize>
1647 <tag/Availability/cc65
1649 <ref id="cbm_k_talk" name="cbm_k_talk">,
1655 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1659 <tag/Function/Input a Character from the Current Device
1660 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1661 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1662 <tag/Description/The function returns a character from the current input device.
1663 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1664 When this function is called, the next byte of data available from the device is returned.
1665 Exception is the routine for the keyboard device (which is the default input device).
1666 <tag/Notes/<itemize>
1669 <tag/Availability/cc65
1671 <ref id="cbm_k_open" name="cbm_k_open">,
1672 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1678 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1682 <tag/Function/Output a byte
1683 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1684 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1685 <tag/Description/Function sends the character to the current output device.
1686 Unless a device has been OPENed and designated as the
1687 current output channel using the CHKOUT routine, the character is
1688 printed to the screen, which is the default output device. If the
1689 cassette is the current device, outputting a byte will only add it to
1690 the buffer. No actual transmission of data will occur until the
1691 192-byte buffer is full.
1692 <tag/Notes/<itemize>
1693 <item>The function is only available as fastcall function, so it may
1694 only be used in presence of a prototype.
1696 <tag/Availability/cc65
1698 <ref id="cbm_k_open" name="cbm_k_open">,
1699 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1705 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1709 <tag/Function/Designate a Logical File As the Current Input Channel
1710 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1711 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1712 <tag/Description/If you wish to
1713 get data from any device other than the keyboard, this function must be
1714 called after OPENing the device, before you can get a data byte with
1715 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1716 the logical file whose file number was supplied as the
1717 current file, its device as the current device, and its secondary
1718 address as the current secondary address. If the device on the
1719 channel is a serial device, which requires a TALK command and
1720 sometimes a secondary address, function will send them over the
1722 <tag/Notes/<itemize>
1723 <item>The function is only available as fastcall function, so it may
1724 only be used in presence of a prototype.
1726 <tag/Availability/cc65
1728 <ref id="cbm_k_open" name="cbm_k_open">,
1729 <ref id="cbm_k_basin" name="cbm_k_basin">,
1730 <ref id="cbm_k_getin" name="cbm_k_getin">
1736 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1740 <tag/Function/Transmit a byte over the serial bus
1741 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1742 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1743 <tag/Description/Purpose of this function is to send a byte of data over
1744 the serial bus. In order for the data to be received, the serial
1745 device must have first been commanded to LISTEN and been given a
1746 secondary address if necessary. This routine always buffers the
1747 current character, and defers sending it until the next byte is
1748 buffered. When the UNLISTEN command is sent, the last byte will be
1749 sent with an End or Identify (EOI).
1750 <tag/Notes/<itemize>
1751 <item>The function is only available as fastcall function, so it may
1752 only be used in presence of a prototype.
1754 <tag/Availability/cc65
1756 <ref id="cbm_k_listen" name="cbm_k_listen">,
1757 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1763 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1767 <tag/Function/Designate a Logical File As the Current Output Channel
1768 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1769 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1770 <tag/Description/If you wish to
1771 output data to any device other than the screen, this routine must be
1772 called after OPENing the device, and before you output a data byte
1773 with the cbm_k_bsout() function. When called, the function will designate the
1774 logical file whose file number was supplied as the current
1775 file, its device as the current device, and its secondary address as
1776 the current secondary address. If the device on the channel uses the
1777 serial bus, and therefore requires a LISTEN command and possibly a
1778 secondary address, this information will be sent on the bus.
1779 <tag/Notes/<itemize>
1780 <item>The function is only available as fastcall function, so it may
1781 only be used in presence of a prototype.
1783 <tag/Availability/cc65
1785 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1786 <ref id="cbm_k_listen" name="cbm_k_listen">
1792 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1796 <tag/Function/Close All Logical I/O Files
1797 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1798 <tag/Declaration/<tt/void cbm_k_clall (void);/
1799 <tag/Description/It closes all
1800 open files, by resetting the index into open files to
1801 zero and restores the default I/O devices.
1802 <tag/Notes/<itemize>
1805 <tag/Availability/cc65
1807 <ref id="cbm_k_open" name="cbm_k_open">,
1808 <ref id="cbm_k_close" name="cbm_k_close">
1814 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1818 <tag/Function/Close a Logical I/O File
1819 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1820 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1821 <tag/Description/It is used to
1822 close a logical file after all I/O operations involving that file have
1824 <tag/Notes/<itemize>
1825 <item>The function is only available as fastcall function, so it may
1826 only be used in presence of a prototype.
1828 <tag/Availability/cc65
1830 <ref id="cbm_k_open" name="cbm_k_open">,
1831 <ref id="cbm_k_clall" name="cbm_k_clall">
1837 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1841 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1842 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1843 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1844 <tag/Description/It sets the
1845 current input device to the keyboard, and the current output device to
1846 the screen. Also, if the current input device was formerly a serial
1847 device, the routine sends it an UNTALK command on the serial bus, and
1848 if a serial device was formerly the current output device, the routine
1849 sends it an UNLISTEN command.
1850 <tag/Notes/<itemize>
1853 <tag/Availability/cc65
1855 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
1856 <ref id="cbm_k_ckout" name="cbm_k_ckout">
1862 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
1866 <tag/Function/Get One Byte from the Input Device
1867 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1868 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
1869 <tag/Description/Function gets a character from the current input device.
1870 <tag/Notes/<itemize>
1873 <tag/Availability/cc65
1875 <ref id="cbm_k_basin" name="cbm_k_basin">
1881 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
1885 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
1886 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1887 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
1888 <tag/Description/This function returns the address of
1889 the memory section where the memory mapped I/O devices are located. This
1890 address can then be used with an offset to access the memory mapped I/O
1891 devices in the Commodore 64. The offset is the number of locations from
1892 the beginning of the page on which the I/O register you want is located.
1893 This function exists to provide compatibility between the Commodore 64,
1894 VIC-20, and future models of the Commodore 64. If the I/O locations for
1895 a program are set by a call to this function, they should
1896 still remain compatible with future versions of the Commodore 64, the
1898 <tag/Notes/<itemize>
1901 <tag/Availability/cc65
1909 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
1913 <tag/Function/Command a device on the serial bus to LISTEN
1914 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1915 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
1916 <tag/Description/This function will command a device on the serial bus to
1917 receive data. The KERNAL routine will OR the supplied device number bit by bit
1918 to convert it to a listen address, then transmits this data as a command on
1919 the serial bus. The specified device will then go into listen mode, and
1920 be ready to accept information.
1921 <tag/Notes/<itemize>
1922 <item>The function is only available as fastcall function, so it may
1923 only be used in presence of a prototype.
1925 <tag/Availability/cc65
1927 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
1933 <sect1>cbm_k_load<label id="cbm_k_load"><p>
1937 <tag/Function/Load RAM from a Device
1938 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1939 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
1940 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
1941 It can also be used for a verify operation, comparing data from a device with the data already in
1942 memory, while leaving the data stored in RAM unchanged.
1943 The flag must be set to 0 for a LOAD operation, or 1 for a
1944 verify, If the input device is OPENed with a secondary address (SA) of 0
1945 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
1946 If the device is addressed with a secondary address of 1, then the data is
1947 loaded into memory starting at the location specified by the header.
1948 Function returns the address of the highest RAM location loaded.
1949 Before this function can be called, the KERNAL SETLFS, and SETNAM
1950 routines must be called.
1951 <tag/Notes/<itemize>
1952 <item>The function is only available as fastcall function, so it may
1953 only be used in presence of a prototype.
1955 <tag/Availability/cc65
1957 <ref id="cbm_k_save" name="cbm_k_save">,
1958 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1959 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1965 <sect1>cbm_k_open<label id="cbm_k_open"><p>
1969 <tag/Function/Open a Logical I/O File
1970 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1971 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
1972 <tag/Description/This function assigns a logical file to a device, so that it can be used for
1973 Input/Output operations. In order to specify the logical file number,
1974 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
1975 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
1976 functions are called, cbm_k_open() is then called.
1977 <tag/Notes/<itemize>
1980 <tag/Availability/cc65
1982 <ref id="cbm_k_close" name="cbm_k_close">,
1983 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1984 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1990 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
1994 <tag/Function/Read status word
1995 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1996 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
1997 <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.
1998 <tag/Notes/<itemize>
2001 <tag/Availability/cc65
2009 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2013 <tag/Function/Save RAM to a Device
2014 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2015 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2016 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2017 used before calling this function. However, a file name is not required to
2018 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2019 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.
2020 <tag/Notes/<itemize>
2021 <item>The function is only available as fastcall function, so it may
2022 only be used in presence of a prototype.
2024 <tag/Availability/cc65
2026 <ref id="cbm_k_load" name="cbm_k_load">,
2027 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2028 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2034 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2038 <tag/Function/Scan the keyboard matrix.
2039 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2040 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2041 <tag/Description/This function looks at the switches in the keyboard, to see
2042 if any of them are being pressed. If they are, then code numbers for them are
2043 stored in RAM. Other functions use those numbers to input text. Normally,
2044 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2045 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2046 function, in order to provide input from the keyboard.
2047 <tag/Availability/cc65
2049 <ref id="cbm_k_getin" name="cbm_k_getin">,
2050 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2051 <ref id="cgetc" name="cgetc">,
2052 <!-- <ref id="getc" name="getc"> -->
2053 <!-- <ref id="getchar" name="getchar"> -->
2059 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2063 <tag/Function/Set up a logical file
2064 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2065 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2066 <tag/Description/This functions sets up the logical file by setting its number, device address,
2067 and secondary address.
2068 <tag/Notes/<itemize>
2069 <item>The function is only available as fastcall function, so it may
2070 only be used in presence of a prototype.
2072 <tag/Availability/cc65
2074 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2080 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2084 <tag/Function/Set Filename Parameters
2085 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2086 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2087 <tag/Description/This function is used to set up the file name for the OPEN,
2088 SAVE, or LOAD operations.
2089 <tag/Notes/<itemize>
2090 <item>The function is only available as fastcall function, so it may
2091 only be used in presence of a prototype.
2093 <tag/Availability/cc65
2095 <ref id="cbm_k_open" name="cbm_k_open">,
2096 <ref id="cbm_k_load" name="cbm_k_load">,
2097 <ref id="cbm_k_save" name="cbm_k_save">
2103 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2107 <tag/Function/Commands device to TALK
2108 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2109 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2110 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2111 bus. This commands the device to TALK.
2112 <tag/Notes/<itemize>
2113 <item>The function is only available as fastcall function, so it may
2114 only be used in presence of a prototype.
2116 <tag/Availability/cc65
2118 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2124 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2128 <tag/Function/Update the Jiffy clock.
2129 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2130 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2131 <tag/Description/This function adds one count to the Jiffy clock. That clock
2132 counts sixtieths of a second. It is used by the library's <tt/clock()/
2133 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2134 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2135 then that ISR must call this function, in order to keep the clock valid.
2136 <tag/Availability/cc65
2138 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2139 <ref id="clock" name="clock">
2145 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2149 <tag/Function/Send an UNLISTEN command
2150 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2151 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2152 <tag/Description/This function commands all devices on the serial bus to
2153 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2154 function results in an UNLISTEN command being transmitted on the serial
2155 bus. Only devices previously commanded to LISTEN are affected. This
2156 function is normally used after the host computer is finished sending data
2157 to external devices. Sending the UNLISTEN commands the listening devices
2158 to get off the serial bus so it can be used for other purposes.
2159 <tag/Notes/<itemize>
2162 <tag/Availability/cc65
2164 <ref id="cbm_k_listen" name="cbm_k_listen">
2169 <sect1>kbrepeat<label id="kbrepeat"><p>
2173 <tag/Function/Set keyboard repeat mode
2174 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2175 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
2176 <tag/Description/This function changes which keys have automatic repeat when
2177 being hold down for a certain time. Possible values are KBREPEAT_CURSOR (repeat
2178 only cursor-related keys), KBREPEAT_NONE (no repeat for any keys) and
2179 KBREPEAT_ALL (repeat all keys). The old mode is returned so it can be restored
2181 <tag/Notes/<itemize>
2182 <item>The function is available only as a fastcall function; so, it may be used
2183 only in the presence of a prototype.
2185 <tag/Availability/cc65
2190 <sect1>cclear<label id="cclear"><p>
2194 <tag/Function/Clear part of a line (write a given number of spaces).
2195 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2196 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2197 <tag/Description/The function clears part of a line by writing <tt/length/
2198 spaces in the current text color.
2199 <tag/Notes/<itemize>
2200 <item>The function is only available as fastcall function, so it may
2201 only be used in presence of a prototype.
2203 <tag/Availability/cc65
2205 <ref id="cclearxy" name="cclearxy">,
2206 <ref id="clrscr" name="clrscr">
2212 <sect1>cclearxy<label id="cclearxy"><p>
2216 <tag/Function/Clear part of a line (write a given number of spaces) starting
2217 at a specific screen position.
2218 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2219 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2220 <tag/Description/The function moves the cursor to a specific position, and
2221 will then clear part of the line by writing <tt/length/ spaces in the current
2223 <tag/Notes/<itemize>
2224 <item>The function is only available as fastcall function, so it may
2225 only be used in presence of a prototype.
2227 <tag/Availability/cc65
2229 <ref id="cclear" name="cclear">,
2230 <ref id="clrscr" name="clrscr">
2236 <sect1>cgetc<label id="cgetc"><p>
2240 <tag/Function/Read a character from the keyboard.
2241 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2242 <tag/Declaration/<tt/char cgetc (void);/
2243 <tag/Description/The function reads a character from the keyboard. If there is
2244 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2245 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2246 displayed while waiting.
2247 <tag/Notes/<itemize>
2248 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2249 from that buffer; and, wait only if the buffer is empty.
2250 <item>The keyboard must be scanned periodically, in order for this function to
2251 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2253 <tag/Availability/cc65
2255 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2256 <ref id="cursor" name="cursor">,
2257 <ref id="kbhit" name="kbhit">
2263 <sect1>chline<label id="chline"><p>
2267 <tag/Function/Output a horizontal line in text mode.
2268 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2269 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2270 <tag/Description/The function outputs a horizontal line with the given length
2271 starting at the current cursor position.
2272 <tag/Notes/<itemize>
2273 <item>The character used to draw the horizontal line is system dependent.
2274 If available, a line drawing character is used. Drawing a line that is partially
2275 off screen leads to undefined behaviour.
2276 <item>The function is only available as fastcall function, so it may only be
2277 used in presence of a prototype.
2279 <tag/Availability/cc65
2281 <ref id="chlinexy" name="chlinexy">,
2282 <ref id="cvline" name="cvline">,
2283 <ref id="cvlinexy" name="cvlinexy">
2289 <sect1>chlinexy<label id="chlinexy"><p>
2293 <tag/Function/Output a horizontal line at a given position in text mode.
2294 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2295 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2296 <tag/Description/The function outputs a horizontal line with the given length
2297 starting at a given position.
2298 <tag/Notes/<itemize>
2299 <item>The character used to draw the horizontal line is system dependent.
2300 If available, a line drawing character is used. Drawing a line that is partially
2301 off screen leads to undefined behaviour.
2302 <item>The function is only available as fastcall function, so it may only be
2303 used in presence of a prototype.
2305 <tag/Availability/cc65
2307 <ref id="chline" name="chline">,
2308 <ref id="cvline" name="cvline">,
2309 <ref id="cvlinexy" name="cvlinexy">
2315 <sect1>clearerr<label id="clearerr"><p>
2319 <tag/Function/Clear error and end-of-file status of a stream.
2320 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2321 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2322 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2323 indicators for the stream <tt/f/.
2324 <tag/Notes/<itemize>
2325 <item>The function is only available as fastcall function, so it may only be
2326 used in presence of a prototype.
2328 <tag/Availability/ISO 9899
2330 <ref id="feof" name="feof">,
2331 <ref id="ferror" name="ferror">
2337 <sect1>clock<label id="clock"><p>
2341 <tag/Function/Determine the processor time used.
2342 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2343 <tag/Declaration/<tt/clock_t clock (void);/
2344 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2345 time used by the program. The time is returned in implementation-defined
2346 units. It can be converted to seconds by dividing by the value of the macro
2347 <tt/CLOCKS_PER_SEC/.
2348 <tag/Notes/<itemize>
2349 <item>Since the machines that cc65-generated programs run on cannot run multiple
2350 processes, the function actually will return the time since some
2351 implementation-defined point in the past.
2352 <item>The Jiffy clock must be "running", in order for this function to return
2353 changing values. (See the description of <tt/cbm_k_udtim()/.)
2355 <tag/Availability/ISO 9899
2357 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2358 <ref id="time" name="time">
2364 <sect1>clrscr<label id="clrscr"><p>
2368 <tag/Function/Clear the text screen.
2369 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2370 <tag/Declaration/<tt/void clrscr (void);/
2371 <tag/Description/The function clears the text screen and moves the cursor to
2372 the upper left corner.
2373 <tag/Availability/cc65
2375 <ref id="cclear" name="cclear">,
2376 <ref id="cclearxy" name="cclearxy">
2382 <sect1>close<label id="close"><p>
2386 <tag/Function/Close a file descriptor.
2387 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2388 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2389 <tag/Description/The function closes the given file descriptor. It returns zero
2390 on success and -1 on error. If an error occurs, the cause can be determined by
2391 reading the <tt/errno/ variable.
2392 <tag/Notes/<itemize>
2393 <item>The function is only available as fastcall function, so it may only
2394 be used in presence of a prototype.
2396 <tag/Availability/POSIX 1003.1
2398 <ref id="creat" name="creat">,
2399 <ref id="open" name="open">
2405 <sect1>closedir<label id="closedir"><p>
2409 <tag/Function/Close a directory.
2410 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2411 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2412 <tag/Description/The function closes the given directory descriptor. It returns
2413 zero on success and -1 on error. If an error occurs, the cause can be determined
2414 by reading the <tt/errno/ variable.
2415 <tag/Notes/<itemize>
2416 <item>The function is only available as fastcall function, so it may only
2417 be used in presence of a prototype.
2419 <tag/Availability/POSIX 1003.1
2421 <ref id="opendir" name="opendir">,
2422 <ref id="readdir" name="readdir">
2428 <sect1>creat<label id="creat"><p>
2432 <tag/Function/Create a file.
2433 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2434 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2435 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2436 associated with it. On error, -1 is returned and an error code is stored in
2438 <tag/Notes/<itemize>
2439 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2440 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2441 <item>The function is only available as fastcall function, so it may only
2442 be used in presence of a prototype.
2444 <tag/Availability/POSIX 1003.1
2446 <ref id="close" name="close">,
2447 <ref id="open" name="open">
2453 <sect1>cprintf<label id="cprintf"><p>
2457 <tag/Function/Formatted output to the console.
2458 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2459 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2460 <tag/Description/The arguments are converted to text where necessary and
2461 formatted according to the format string given. The resulting string is output
2462 to the console. <tt/cprintf/ supports the same format specifiers as
2463 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2464 <tag/Notes/<itemize>
2465 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2466 between <tt/\r/ and <tt/\n/.
2468 <tag/Availability/cc65
2470 <ref id="cputc" name="cputc">,
2471 <ref id="cputcxy" name="cputcxy">,
2472 <ref id="cputs" name="cputs">,
2473 <ref id="cputsxy" name="cputsxy">,
2474 <ref id="vcprintf" name="vcprintf">
2480 <sect1>cputc<label id="cputc"><p>
2484 <tag/Function/Output a character directly to the console.
2485 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2486 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2487 <tag/Description/Output one character to the console at the current cursor
2489 <tag/Notes/<itemize>
2490 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2491 between <tt/\r/ and <tt/\n/.
2492 <item>The function is only available as fastcall function, so it may only
2493 be used in presence of a prototype.
2495 <tag/Availability/cc65
2497 <ref id="cprintf" name="cprintf">,
2498 <ref id="cputcxy" name="cputcxy">,
2499 <ref id="cputs" name="cputs">,
2500 <ref id="cputsxy" name="cputsxy">,
2501 <ref id="vcprintf" name="vcprintf">
2507 <sect1>cputcxy<label id="cputcxy"><p>
2511 <tag/Function/Output a character at a specific screen position.
2512 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2513 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2514 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2515 the screen and outputs one character.
2516 <tag/Notes/<itemize>
2517 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2518 between <tt/\r/ and <tt/\n/.
2519 <item>The function is only available as fastcall function, so it may only
2520 be used in presence of a prototype.
2522 <tag/Availability/cc65
2524 <ref id="cprintf" name="cprintf">,
2525 <ref id="cputc" name="cputc">,
2526 <ref id="cputs" name="cputs">,
2527 <ref id="cputsxy" name="cputsxy">,
2528 <ref id="vcprintf" name="vcprintf">
2534 <sect1>cputs<label id="cputs"><p>
2538 <tag/Function/Output a string directly to the console.
2539 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2540 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2541 <tag/Description/The function outputs the given string on the console at the
2542 current cursor position.
2543 <tag/Notes/<itemize>
2544 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2545 between <tt/\r/ and <tt/\n/.
2546 <item>The function is only available as fastcall function, so it may only
2547 be used in presence of a prototype.
2549 <tag/Availability/cc65
2551 <ref id="cprintf" name="cprintf">,
2552 <ref id="cputc" name="cputc">,
2553 <ref id="cputcxy" name="cputcxy">,
2554 <ref id="cputsxy" name="cputsxy">,
2555 <ref id="vcprintf" name="vcprintf">
2561 <sect1>cputsxy<label id="cputsxy"><p>
2565 <tag/Function/Output a string to the console at a given position.
2566 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2567 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2568 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2569 and outputs the string <tt/s/.
2570 <tag/Notes/<itemize>
2571 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2572 between <tt/\r/ and <tt/\n/.
2573 <item>The function is only available as fastcall function, so it may only
2574 be used in presence of a prototype.
2576 <tag/Availability/cc65
2578 <ref id="cprintf" name="cprintf">,
2579 <ref id="cputc" name="cputc">,
2580 <ref id="cputcxy" name="cputcxy">,
2581 <ref id="cputs" name="cputs">,
2582 <ref id="vcprintf" name="vcprintf">
2588 <sect1>cursor<label id="cursor"><p>
2592 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2593 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2594 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2595 <tag/Description/If the argument to the function is non zero, a blinking cursor
2596 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2597 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2598 <tag/Notes/<itemize>
2599 <item>The function is only available as fastcall function, so it may only
2600 be used in presence of a prototype.
2602 <tag/Availability/cc65
2604 <ref id="cgetc" name="cgetc">,
2605 <ref id="kbhit" name="kbhit">
2611 <sect1>cvline<label id="cvline"><p>
2615 <tag/Function/Output a vertical line in text mode.
2616 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2617 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2618 <tag/Description/The function outputs a vertical line with the given length
2619 starting at the current cursor position.
2620 <tag/Notes/<itemize>
2621 <item>The character used to draw the vertical line is system dependent.
2622 If available, a line drawing character is used. Drawing a line that is partially
2623 off screen leads to undefined behaviour.
2624 <item>The function is only available as fastcall function, so it may only be
2625 used in presence of a prototype.
2627 <tag/Availability/cc65
2629 <ref id="chline" name="chline">,
2630 <ref id="chlinexy" name="chlinexy">,
2631 <ref id="cvlinexy" name="cvlinexy">
2637 <sect1>cvlinexy<label id="cvlinexy"><p>
2641 <tag/Function/Output a vertical line at a given position in text mode.
2642 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2643 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2644 <tag/Description/The function outputs a vertical line with the given length
2645 starting at a given position.
2646 <tag/Notes/<itemize>
2647 <item>The character used to draw the vertical line is system dependent.
2648 If available, a line drawing character is used. Drawing a line that is partially
2649 off screen leads to undefined behaviour.
2650 <item>The function is only available as fastcall function, so it may only be
2651 used in presence of a prototype.
2653 <tag/Availability/cc65
2655 <ref id="chline" name="chline">,
2656 <ref id="chlinexy" name="chlinexy">,
2657 <ref id="cvline" name="cvline">
2663 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2667 <tag/Function/Uncompress a LZ4-compressed buffer.
2668 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2669 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2670 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2671 <tag/Notes/<itemize>
2672 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2674 <tag/Availability/cc65
2680 <sect1>div<label id="div"><p>
2684 <tag/Function/Divide two ints and return quotient and remainder.
2685 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2686 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2687 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2688 quotient and remainder in a <tt/div_t/ structure.
2689 <tag/Notes/<itemize>
2690 <item>The function is only available as fastcall function, so it may only
2691 be used in presence of a prototype.
2693 <tag/Availability/ISO 9899
2701 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
2705 <tag/Function/Determines whether the screen is going to be cleared after program exit.
2706 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
2707 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
2708 <tag/Description/The function returns zero if the screen won't be cleared immediately after
2709 program termination. It returns a non-zero value if it will.
2710 <tag/Notes/<itemize>
2711 <item>Some systems, maybe depending on configuration, immediately clear the screen
2712 after a program exits. Therefore it might be difficult to read
2713 the last messages printed by the program prior to its exit. This function can be used
2714 to decide if a delay or wait for a key press should be executed when then program
2717 <tag/Availability/cc65
2725 printf("Hello World\n");
2726 if (doesclrscrafterexit())
2735 <sect1>em_commit<label id="em_commit"><p>
2739 <tag/Function/Commit changes into extended memory.
2740 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2741 <tag/Declaration/<tt/void em_commit (void);/
2742 <tag/Description/Commit changes in the memory window to extended storage. If
2743 the contents of the memory window have been changed, these changes may be lost
2744 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
2745 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
2746 name="em_copyto">/ are called without calling <tt/em_commit/ first.
2747 <tag/Notes/<itemize>
2748 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
2749 memory window are discarded, it does just mean that the drivers is allowed
2751 <item>The function is only available as fastcall function, so it may only be
2752 used in presence of a prototype.
2753 <item>The function produces undefined results if no extended memory driver is
2756 <tag/Availability/cc65
2758 <ref id="em_load_driver" name="em_load_driver">,
2759 <ref id="em_map" name="em_map">,
2760 <ref id="em_use" name="em_use">
2766 <sect1>em_copyfrom<label id="em_copyfrom"><p>
2770 <tag/Function/Copy from extended into normal memory.
2771 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2772 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
2773 <tag/Description/Copy data from extended memory into linear memory. Source and
2774 target addresses as well as the number of bytes to transfer are specified in
2775 the <tt/em_copy/ structure that is passed as a parameter.
2776 <tag/Notes/<itemize>
2777 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
2778 made any changes to the data in the window, call <tt/<ref id="em_commit"
2779 name="em_commit">/ first, or the changes are lost.
2780 <item>The function is only available as fastcall function, so it may only be
2781 used in presence of a prototype.
2782 <item>The function produces undefined results if no extended memory driver is
2785 <tag/Availability/cc65
2787 <ref id="em_commit" name="em_commit">,
2788 <ref id="em_copyto" name="em_copyto">,
2789 <ref id="em_load_driver" name="em_load_driver">
2795 <sect1>em_copyto<label id="em_copyto"><p>
2799 <tag/Function/Copy from normal into extended memory.
2800 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2801 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
2802 <tag/Description/Copy data from linear into extended memory. Source and
2803 target addresses as well as the number of bytes to transfer are specified in
2804 the <tt/em_copy/ structure that is passed as a parameter.
2805 <tag/Notes/<itemize>
2806 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
2807 made any changes to the data in the window, call <tt/<ref id="em_commit"
2808 name="em_commit">/ first, or the changes are lost.
2809 <item>The function is only available as fastcall function, so it may only be
2810 used in presence of a prototype.
2811 <item>The function produces undefined results if no extended memory driver is
2814 <tag/Availability/cc65
2816 <ref id="em_commit" name="em_commit">,
2817 <ref id="em_copyfrom" name="em_copyfrom">,
2818 <ref id="em_load_driver" name="em_load_driver">
2824 <sect1>em_install<label id="em_install"><p>
2828 <tag/Function/Install an already loaded extended memory driver.
2829 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2830 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
2831 <tag/Description/The function installs an already loaded extended memory driver
2832 and returns an error code. The function may be used to install a driver linked
2833 statically to the program.
2834 <tag/Notes/<itemize>
2835 <item>Not all drivers are able to detect if the supported hardware is really
2837 <item>The function is only available as fastcall function, so it may only be
2838 used in presence of a prototype.
2840 <tag/Availability/cc65
2842 <ref id="em_load_driver" name="em_load_driver">,
2843 <ref id="em_uninstall" name="em_uninstall">,
2844 <ref id="em_unload" name="em_unload">
2850 <sect1>em_load_driver<label id="em_load_driver"><p>
2854 <tag/Function/Load and initialize an extended memory driver.
2855 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2856 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
2857 <tag/Description/Load an extended memory driver into memory and initialize
2858 it. The function returns an error code that tells if all this has been
2860 <tag/Notes/<itemize>
2861 <item>Not all drivers are able to detect if the supported hardware is really
2863 <item>The function is only available as fastcall function, so it may only be
2864 used in presence of a prototype.
2865 <item>The driver is loaded by name, so currently you must know the type of
2866 extended memory that should be supported. There is no autodetect capability.
2868 <tag/Availability/cc65
2870 <ref id="em_unload" name="em_unload">
2876 <sect1>em_map<label id="em_map"><p>
2880 <tag/Function/Make a page of extended memory accessible.
2881 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2882 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
2883 <tag/Description/The function maps one page of extended memory into linear
2884 memory and returns a pointer to the page frame. Depending on the hardware
2885 and driver, the data is either mapped into the address space or transfered
2886 into a buffer. If you don't need the actual contents of the page (for example
2887 because you're going to overwrite it completely), it is better to call
2888 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
2889 data if it is possible to avoid that.
2890 <tag/Notes/<itemize>
2891 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
2892 made any changes to the data in the window, call <tt/<ref id="em_commit"
2893 name="em_commit">/ first, or the changes are lost.
2894 <item>The function is only available as fastcall function, so it may only be
2895 used in presence of a prototype.
2896 <item>The function produces undefined results if no extended memory driver is
2899 <tag/Availability/cc65
2901 <ref id="em_commit" name="em_commit">,
2902 <ref id="em_load_driver" name="em_load_driver">,
2903 <ref id="em_use" name="em_use">
2909 <sect1>em_pagecount<label id="em_pagecount"><p>
2913 <tag/Function/Return the number of available extended memory pages.
2914 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2915 <tag/Declaration/<tt/unsigned em_pagecount (void);/
2916 <tag/Description/The function returns the size of the extended memory supported
2917 by the driver in 256 byte pages.
2918 <tag/Notes/<itemize>
2919 <item>The function returns zero if no extended memory driver is loaded.
2920 <item>The function may return zero if the supported hardware was not detected.
2922 <tag/Availability/cc65
2924 <ref id="em_load_driver" name="em_load_driver">
2930 <sect1>em_uninstall<label id="em_uninstall"><p>
2934 <tag/Function/Uninstall an already loaded extended memory driver.
2935 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2936 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
2937 <tag/Description/The function uninstalls an already loaded extended memory
2938 driver but doesn't remove it from memory.
2939 <tag/Notes/<itemize>
2940 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
2941 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
2942 should be used instead of <tt/em_uninstall/ so the driver is also removed
2945 <tag/Availability/cc65
2947 <ref id="em_install" name="em_install">,
2948 <ref id="em_load_driver" name="em_load_driver">,
2949 <ref id="em_unload" name="em_unload">
2955 <sect1>em_unload<label id="em_unload"><p>
2959 <tag/Function/Unload an extended memory driver.
2960 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2961 <tag/Declaration/<tt/unsigned char em_unload (void);/
2962 <tag/Description/The function unloads a loaded extended memory driver and
2963 frees all memory allocated for the driver.
2964 <tag/Notes/<itemize>
2965 <item>The function does nothing if no driver is loaded.
2967 <tag/Availability/cc65
2969 <ref id="em_load_driver" name="em_load_driver">
2975 <sect1>em_use<label id="em_use"><p>
2979 <tag/Function/Prepare an extended memory page for use.
2980 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2981 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
2982 <tag/Description/The function maps one page of extended memory into linear
2983 memory and returns a pointer to the page frame. This function is similar to
2984 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
2985 actual memory window in the assumption that the existing data is wrong or
2986 will get overwritten.
2987 <tag/Notes/<itemize>
2988 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
2989 made any changes to the data in the window, call <tt/<ref id="em_commit"
2990 name="em_commit">/ first, or the changes are lost.
2991 <item>The function is only available as fastcall function, so it may only be
2992 used in presence of a prototype.
2993 <item>The function produces undefined results if no extended memory driver is
2996 <tag/Availability/cc65
2998 <ref id="em_commit" name="em_commit">,
2999 <ref id="em_load_driver" name="em_load_driver">,
3000 <ref id="em_map" name="em_map">
3006 <sect1>exit<label id="exit"><p>
3010 <tag/Function/Terminate the program.
3011 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3012 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3013 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3014 return code of the program. Before termination, all files are closed, buffered
3015 output is written and any functions registered with <tt/<ref id="atexit"
3016 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3017 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3019 <tag/Notes/<itemize>
3020 <item>The function is only available as fastcall function, so it may only
3021 be used in presence of a prototype.
3022 <item>It depends on the host machine if the program return code can be
3023 evaluated or is ignored.
3025 <tag/Availability/ISO 9899
3027 <ref id="abort" name="abort">,
3028 <ref id="exit" name="exit">
3034 <sect1>exec<label id="exec"><p>
3038 <tag/Function/Execute a program file.
3039 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3040 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3041 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3042 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3043 then loading and starting the program named in the first argument, passing
3044 the command line specified as second argument. Instead of an empty string,
3045 a <tt/NULL/ pointer may be passed as second parameter.
3046 On success, the function does not return. On failure, -1 is returned and
3047 <tt/errno/ contains an error code.
3048 <tag/Notes/<itemize>
3049 <item>The function is only available as fastcall function, so it may only
3050 be used in presence of a prototype.
3051 <item>On most platforms, the function needs to copy a small stub loader to
3052 some memory area outside the program space. This may collide with other
3053 programs. See the platform specific docs on this.
3054 <item>Because it is necessary to terminate the running program before the
3055 memory can be reused to load the new one, there is a high chance that the
3056 function may not be able to return on errors.
3057 <item>The command line is passed to the new program in the same way as cc65
3058 programs expect the command line. If the new program is not a cc65 generated
3059 program, it may not be able to read it.
3061 <tag/Availability/cc65
3063 <ref id="exit" name="exit">
3069 <sect1>fast<label id="fast"><p>
3073 <tag/Function/Switch the C128 into 2MHz mode.
3074 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3075 <tag/Declaration/<tt/void fast (void);/
3076 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
3077 will nearly double the speed compared to slow mode.
3078 <tag/Notes/<itemize>
3079 <item>The function is specific to the C128.
3080 <item>2MHz clock will not work in 40 column mode.
3082 <tag/Availability/C128
3084 <ref id="slow" name="slow">,
3085 <ref id="toggle_videomode" name="toggle_videomode">,
3086 <ref id="videomode" name="videomode">
3092 <sect1>feof<label id="feof"><p>
3096 <tag/Function/Return the end-of-file indicator of a stream.
3097 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3098 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3099 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3100 <tt/f/, and returns a non zero value if it is set.
3101 <tag/Notes/<itemize>
3102 <item>The indicator is set only after a read past the end of a file is
3104 <item>The function is only available as fastcall function, so it may only be
3105 used in presence of a prototype.
3107 <tag/Availability/ISO 9899
3109 <ref id="feof" name="clearerr">,
3110 <ref id="ferror" name="ferror">
3116 <sect1>ferror<label id="ferror"><p>
3120 <tag/Function/Return the error indicator of a stream.
3121 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3122 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3123 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3124 <tt/f/, and returns a non zero value if it is set.
3125 <tag/Notes/<itemize>
3126 <item>The function is only available as fastcall function, so it may only be
3127 used in presence of a prototype.
3129 <tag/Availability/ISO 9899
3131 <ref id="feof" name="clearerr">,
3132 <ref id="ferror" name="feof">
3138 <sect1>fileno<label id="fileno"><p>
3142 <tag/Function/Return the file handle used by a stream.
3143 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3144 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3145 <tag/Description/The <tt/fileno/ function returns the file handle used
3146 internally by a C stream. This file handle (an integer) can be used as a
3147 handle for the POSIX input/output functions.
3148 <tag/Notes/<itemize>
3149 <item>The function is only available as fastcall function, so it may only be
3150 used in presence of a prototype.
3151 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3152 file may have unpredictable results.
3154 <tag/Availability/POSIX 1003.1
3156 <ref id="creat" name="creat">,
3157 <ref id="open" name="open"> <!-- , -->
3158 <!-- <ref id="read" name="read">, -->
3159 <!-- <ref id="write" name="write"> -->
3165 <sect1>free<label id="free"><p>
3169 <tag/Function/Free a block of dynamic memory.
3170 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3171 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3172 <tag/Description/Free a block of dynamic memory previously allocated with
3173 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3174 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3175 pointer is <tt/NULL/, no action is performed.
3176 <tag/Notes/<itemize>
3177 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3178 behaviour and may crash your program.
3179 <item>The function is only available as fastcall function, so it may only
3180 be used in presence of a prototype.
3182 <tag/Availability/ISO 9899
3184 <ref id="_heapadd" name="_heapadd">,
3185 <ref id="_heapblocksize" name="_heapblocksize">,
3186 <ref id="_heapmaxavail" name="_heapmaxavail">,
3187 <ref id="_heapmemavail" name="_heapmemavail">,
3188 <ref id="calloc" name="calloc">,
3189 <ref id="malloc" name="malloc">,
3190 <ref id="realloc" name="realloc">
3196 <sect1>get_ostype<label id="get_ostype"><p>
3200 <tag/Function/The function returns the operating system, the program runs on.
3201 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3202 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3203 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3204 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3205 all supported targets. If it exists, it returns a number that identifies the
3206 operating system or machine type, the program runs on. The machine dependent
3207 header files define constants that can be used to check the return code.
3208 <tag/Notes/<itemize>
3209 <item>The function does not exist on all platforms.
3210 <item>The return codes are platform dependent.
3212 <tag/Availability/cc65 (not all platforms)
3218 <sect1>getcpu<label id="getcpu"><p>
3222 <tag/Function/Determine on which CPU the program is running.
3223 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3224 <tag/Declaration/<tt/unsigned char getcpu (void);/
3225 <tag/Description/The function checks on which CPU the code is running. It
3226 returns one of the constants<itemize>
3228 <item><tt/CPU_65C02/
3229 <item><tt/CPU_65816/
3231 <tag/Notes/<itemize>
3232 <item>Other, more exotic CPU types are not disinguished.
3234 <tag/Availability/cc65
3240 <sect1>getenv<label id="getenv"><p>
3244 <tag/Function/Return a value from the environment.
3245 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3246 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3247 <tag/Description/The function searches the environment for an entry that
3248 matches <tt/name/ and returns its value. The environment consists of a list
3249 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3251 <tag/Notes/<itemize>
3252 <item>What exactly is stored in the environment depends on the machine the
3253 program is running on.
3254 <item>The function is only available as fastcall function, so it may only
3255 be used in presence of a prototype.
3257 <tag/Availability/ISO 9899
3263 <sect1>getopt<label id="getopt"><p>
3267 <tag/Function/Parse command line options.
3268 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3269 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3270 const char* optstring);/
3271 <tag/Description/The function parses command line arguments, <tt/argc/ and
3272 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3273 is a string that contains command line option characters. If a character in
3274 <tt/optstring/ is followed by a colon, the option requires an argument. An
3275 option on the command line is recognized if it is one of the option characters
3277 <tt/getopt/ must be called repeatedly. It will return each option character
3278 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3279 option argument is placed in <tt/optarg/, the index of the next element on the
3280 command line to be processed is placed in <tt/optind/.
3281 <tag/Notes/<itemize>
3282 <item>The implementation will not reorder options. A non option on the command
3283 line will terminate option processing. All remaining arguments are not
3284 recognized as options, even if the start with a '-' character.
3285 <item>The function is only available as fastcall function, so it may only
3286 be used in presence of a prototype.
3288 <tag/Availability/POSIX.2
3294 <sect1>gotox<label id="gotox"><p>
3298 <tag/Function/Move the text mode cursor to a new X position.
3299 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3300 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3301 <tag/Description/The function moves the text mode cursor to the specified X
3302 position while leaving the Y position untouched. The leftmost position on the
3303 screen has the coordinate 0.
3304 <tag/Notes/<itemize>
3305 <item>The function is only available as fastcall function, so it may
3306 only be used in presence of a prototype.
3307 <item>Invalid values for the X position (out of screen coordinates) may
3308 lead to undefined behaviour.
3310 <tag/Availability/cc65
3312 <ref id="gotoy" name="gotoy">,
3313 <ref id="gotoxy" name="gotoxy">,
3314 <ref id="wherex" name="wherex">,
3315 <ref id="wherey" name="wherey">
3321 <sect1>gotoxy<label id="gotoxy"><p>
3325 <tag/Function/Move the text mode cursor to a new position.
3326 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3327 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3328 <tag/Description/The function moves the text mode cursor to the specified
3329 position. The leftmost position on the screen has the X coordinate 0, the
3330 topmost line has the Y coordinate 0.
3331 <tag/Notes/<itemize>
3332 <item>The function is only available as fastcall function, so it may only be
3333 used in presence of a prototype.
3334 <item>Invalid values for any of both coordinates (out of screen positions) may
3335 lead to undefined behaviour.
3337 <tag/Availability/cc65
3339 <ref id="gotox" name="gotox">,
3340 <ref id="gotoy" name="gotoy">,
3341 <ref id="wherex" name="wherex">,
3342 <ref id="wherey" name="wherey">
3348 <sect1>gotoy<label id="gotoy"><p>
3352 <tag/Function/Move the text mode cursor to a new Y position.
3353 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3354 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3355 <tag/Description/The function moves the text mode cursor to the specified Y
3356 position while leaving the X position untouched. The uppermost position on the
3357 screen has the coordinate 0.
3358 <tag/Notes/<itemize>
3359 <item>The function is only available as fastcall function, so it may
3360 only be used in presence of a prototype.
3361 <item>Invalid values for the Y position (out of screen coordinates) may lead
3362 to undefined behaviour.
3364 <tag/Availability/cc65
3366 <ref id="gotox" name="gotox">,
3367 <ref id="gotoxy" name="gotoxy">,
3368 <ref id="wherex" name="wherex">,
3369 <ref id="wherey" name="wherey">
3375 <sect1>isalnum<label id="isalnum"><p>
3379 <tag/Function/Check if a given character is a letter or digit.
3380 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3381 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3382 <tag/Description/The function returns a non zero value if the given argument
3383 is a letter or digit. The return value is zero if the character is anything
3385 <tag/Notes/<itemize>
3386 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3387 inline sequence generated by the macro will not work correctly for values
3388 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3389 this range. The non inline function may be accessed by <tt/#undef/'ing
3391 <item>When compiling without <tt/-Os/, the function is only available as
3392 fastcall function, so it may only be used in presence of a prototype.
3394 <tag/Availability/ISO 9899
3396 <ref id="isalpha" name="isalpha">,
3397 <ref id="isascii" name="isascii">,
3398 <ref id="isblank" name="isblank">,
3399 <ref id="iscntrl" name="iscntrl">,
3400 <ref id="isdigit" name="isdigit">,
3401 <ref id="isgraph" name="isgraph">,
3402 <ref id="islower" name="islower">,
3403 <ref id="isprint" name="isprint">,
3404 <ref id="ispunct" name="ispunct">,
3405 <ref id="isspace" name="isspace">,
3406 <ref id="isupper" name="isupper">,
3407 <ref id="isxdigit" name="isxdigit">
3413 <sect1>isalpha<label id="isalpha"><p>
3417 <tag/Function/Check if a given character is a letter.
3418 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3419 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3420 <tag/Description/The function returns a non zero value if the given argument
3421 is a letter. The return value is zero if the character is anything else.
3422 <tag/Notes/<itemize>
3423 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3424 inline sequence generated by the macro will not work correctly for values
3425 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3426 this range. The non inline function may be accessed by <tt/#undef/'ing the
3428 <item>When compiling without <tt/-Os/, the function is only available as
3429 fastcall function, so it may only be used in presence of a prototype.
3431 <tag/Availability/ISO 9899
3433 <ref id="isalnum" name="isalnum">,
3434 <ref id="isascii" name="isascii">,
3435 <ref id="isblank" name="isblank">,
3436 <ref id="iscntrl" name="iscntrl">,
3437 <ref id="isdigit" name="isdigit">,
3438 <ref id="isgraph" name="isgraph">,
3439 <ref id="islower" name="islower">,
3440 <ref id="isprint" name="isprint">,
3441 <ref id="ispunct" name="ispunct">,
3442 <ref id="isspace" name="isspace">,
3443 <ref id="isupper" name="isupper">,
3444 <ref id="isxdigit" name="isxdigit">
3450 <sect1>isascii<label id="isascii"><p>
3454 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3455 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3456 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3457 <tag/Description/The function returns a non zero value if the given argument
3458 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3459 <tag/Notes/<itemize>
3460 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3461 inline sequence generated by the macro will not work correctly for values
3462 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3463 this range. The non inline function may be accessed by <tt/#undef/'ing the
3465 <item>When compiling without <tt/-Os/, the function is only available as
3466 fastcall function, so it may only be used in presence of a prototype.
3468 <tag/Availability/ISO 9899
3470 <ref id="isalnum" name="isalnum">,
3471 <ref id="isalpha" name="isalpha">,
3472 <ref id="isblank" name="isblank">,
3473 <ref id="iscntrl" name="iscntrl">,
3474 <ref id="isdigit" name="isdigit">,
3475 <ref id="isgraph" name="isgraph">,
3476 <ref id="islower" name="islower">,
3477 <ref id="isprint" name="isprint">,
3478 <ref id="ispunct" name="ispunct">,
3479 <ref id="isspace" name="isspace">,
3480 <ref id="isupper" name="isupper">,
3481 <ref id="isxdigit" name="isxdigit">
3487 <sect1>isblank<label id="isblank"><p>
3491 <tag/Function/Check if a given character is a space or tab.
3492 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3493 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3494 <tag/Description/The function returns a non zero value if the given argument
3495 is a space or tab character. The return value is zero if the character is
3497 <tag/Notes/<itemize>
3498 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3499 inline sequence generated by the macro will not work correctly for values
3500 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3501 this range. The non inline function may be accessed by <tt/#undef/'ing the
3503 <item>When compiling without <tt/-Os/, the function is only available as
3504 fastcall function, so it may only be used in presence of a prototype.
3506 <tag/Availability/ISO 9899
3508 <ref id="isalnum" name="isalnum">,
3509 <ref id="isalpha" name="isalpha">,
3510 <ref id="isascii" name="isascii">,
3511 <ref id="iscntrl" name="iscntrl">,
3512 <ref id="isdigit" name="isdigit">,
3513 <ref id="isgraph" name="isgraph">,
3514 <ref id="islower" name="islower">,
3515 <ref id="isprint" name="isprint">,
3516 <ref id="ispunct" name="ispunct">,
3517 <ref id="isspace" name="isspace">,
3518 <ref id="isupper" name="isupper">,
3519 <ref id="isxdigit" name="isxdigit">
3525 <sect1>iscntrl<label id="iscntrl"><p>
3529 <tag/Function/Check if a given character is a control character.
3530 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3531 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3532 <tag/Description/The function returns a non zero value if the given argument
3533 is a control character. The return value is zero if the character is anything
3535 <tag/Notes/<itemize>
3536 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3537 inline sequence generated by the macro will not work correctly for values
3538 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3539 this range. The non inline function may be accessed by <tt/#undef/'ing the
3541 <item>When compiling without <tt/-Os/, the function is only available as
3542 fastcall function, so it may only be used in presence of a prototype.
3544 <tag/Availability/ISO 9899
3546 <ref id="isalnum" name="isalnum">,
3547 <ref id="isalpha" name="isalpha">,
3548 <ref id="isascii" name="isascii">,
3549 <ref id="isblank" name="isblank">,
3550 <ref id="isdigit" name="isdigit">,
3551 <ref id="isgraph" name="isgraph">,
3552 <ref id="islower" name="islower">,
3553 <ref id="isprint" name="isprint">,
3554 <ref id="ispunct" name="ispunct">,
3555 <ref id="isspace" name="isspace">,
3556 <ref id="isupper" name="isupper">,
3557 <ref id="isxdigit" name="isxdigit">
3563 <sect1>isdigit<label id="isdigit"><p>
3567 <tag/Function/Check if a given character is a digit.
3568 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3569 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
3570 <tag/Description/The function returns a non zero value if the given argument
3571 is a digit. The return value is zero if the character is anything else.
3572 <tag/Notes/<itemize>
3573 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3574 inline sequence generated by the macro will not work correctly for values
3575 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3576 this range. The non inline function may be accessed by <tt/#undef/'ing the
3578 <item>When compiling without <tt/-Os/, the function is only available as
3579 fastcall function, so it may only be used in presence of a prototype.
3581 <tag/Availability/ISO 9899
3583 <ref id="isalnum" name="isalnum">,
3584 <ref id="isalpha" name="isalpha">,
3585 <ref id="isascii" name="isascii">,
3586 <ref id="isblank" name="isblank">,
3587 <ref id="iscntrl" name="iscntrl">,
3588 <ref id="isgraph" name="isgraph">,
3589 <ref id="islower" name="islower">,
3590 <ref id="isprint" name="isprint">,
3591 <ref id="ispunct" name="ispunct">,
3592 <ref id="isspace" name="isspace">,
3593 <ref id="isupper" name="isupper">,
3594 <ref id="isxdigit" name="isxdigit">
3600 <sect1>isgraph<label id="isgraph"><p>
3604 <tag/Function/Check if a given character is a printable character (except
3606 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3607 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
3608 <tag/Description/The function returns a non zero value if the given argument
3609 is a printable character with the exception of space. The return value is zero
3610 if the character is anything else.
3611 <tag/Notes/<itemize>
3612 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3613 inline sequence generated by the macro will not work correctly for values
3614 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3615 this range. The non inline function may be accessed by <tt/#undef/'ing the
3617 <item>When compiling without <tt/-Os/, the function is only available as
3618 fastcall function, so it may only be used in presence of a prototype.
3620 <tag/Availability/ISO 9899
3622 <ref id="isalnum" name="isalnum">,
3623 <ref id="isalpha" name="isalpha">,
3624 <ref id="isascii" name="isascii">,
3625 <ref id="isblank" name="isblank">,
3626 <ref id="iscntrl" name="iscntrl">,
3627 <ref id="isdigit" name="isdigit">,
3628 <ref id="islower" name="islower">,
3629 <ref id="isprint" name="isprint">,
3630 <ref id="ispunct" name="ispunct">,
3631 <ref id="isspace" name="isspace">,
3632 <ref id="isupper" name="isupper">,
3633 <ref id="isxdigit" name="isxdigit">
3639 <sect1>islower<label id="islower"><p>
3643 <tag/Function/Check if a given character is a lower case letter.
3644 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3645 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
3646 <tag/Description/The function returns a non zero value if the given argument
3647 is a lower case letter. The return value is zero if the character is anything
3649 <tag/Notes/<itemize>
3650 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3651 inline sequence generated by the macro will not work correctly for values
3652 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3653 this range. The non inline function may be accessed by <tt/#undef/'ing the
3655 <item>When compiling without <tt/-Os/, the function is only available as
3656 fastcall function, so it may only be used in presence of a prototype.
3658 <tag/Availability/ISO 9899
3660 <ref id="isalnum" name="isalnum">,
3661 <ref id="isalpha" name="isalpha">,
3662 <ref id="isascii" name="isascii">,
3663 <ref id="isblank" name="isblank">,
3664 <ref id="iscntrl" name="iscntrl">,
3665 <ref id="isdigit" name="isdigit">,
3666 <ref id="isgraph" name="isgraph">,
3667 <ref id="isprint" name="isprint">,
3668 <ref id="ispunct" name="ispunct">,
3669 <ref id="isspace" name="isspace">,
3670 <ref id="isupper" name="isupper">,
3671 <ref id="isxdigit" name="isxdigit">
3677 <sect1>isprint<label id="isprint"><p>
3681 <tag/Function/Check if a given character is a printable character.
3682 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3683 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
3684 <tag/Description/The function returns a non zero value if the given argument
3685 is a printable character (this includes the space character). The return value
3686 is zero if the character is anything else.
3687 <tag/Notes/<itemize>
3688 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3689 inline sequence generated by the macro will not work correctly for values
3690 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3691 this range. The non inline function may be accessed by <tt/#undef/'ing the
3693 <item>When compiling without <tt/-Os/, the function is only available as
3694 fastcall function, so it may only be used in presence of a prototype.
3696 <tag/Availability/ISO 9899
3698 <ref id="isalnum" name="isalnum">,
3699 <ref id="isalpha" name="isalpha">,
3700 <ref id="isascii" name="isascii">,
3701 <ref id="isblank" name="isblank">,
3702 <ref id="iscntrl" name="iscntrl">,
3703 <ref id="isdigit" name="isdigit">,
3704 <ref id="isgraph" name="isgraph">,
3705 <ref id="islower" name="islower">,
3706 <ref id="ispunct" name="ispunct">,
3707 <ref id="isspace" name="isspace">,
3708 <ref id="isupper" name="isupper">,
3709 <ref id="isxdigit" name="isxdigit">
3715 <sect1>ispunct<label id="ispunct"><p>
3719 <tag/Function/Check if a given character is a printable character but not a
3720 space or an alphanumeric character.
3721 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3722 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
3723 <tag/Description/The function returns a non zero value if the given argument
3724 is a printable character, but not a space or anything alphanumeric. The return
3725 value is zero if the character is anything else.
3726 <tag/Notes/<itemize>
3727 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3728 inline sequence generated by the macro will not work correctly for values
3729 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3730 this range. The non inline function may be accessed by <tt/#undef/'ing the
3732 <item>When compiling without <tt/-Os/, the function is only available as
3733 fastcall function, so it may only be used in presence of a prototype.
3735 <tag/Availability/ISO 9899
3737 <ref id="isalnum" name="isalnum">,
3738 <ref id="isalpha" name="isalpha">,
3739 <ref id="isascii" name="isascii">,
3740 <ref id="isblank" name="isblank">,
3741 <ref id="iscntrl" name="iscntrl">,
3742 <ref id="isdigit" name="isdigit">,
3743 <ref id="isgraph" name="isgraph">,
3744 <ref id="islower" name="islower">,
3745 <ref id="isprint" name="isprint">,
3746 <ref id="isspace" name="isspace">,
3747 <ref id="isupper" name="isupper">,
3748 <ref id="isxdigit" name="isxdigit">
3754 <sect1>isspace<label id="isspace"><p>
3758 <tag/Function/Check if a given character is a white-space character.
3759 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3760 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
3761 <tag/Description/The function returns a non zero value if the given argument
3762 is a white space character. The return value is zero if the character is
3763 anything else. The standard white space characters are: space, formfeed ('\f'),
3764 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
3766 <tag/Notes/<itemize>
3767 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3768 inline sequence generated by the macro will not work correctly for values
3769 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3770 this range. The non inline function may be accessed by <tt/#undef/'ing the
3772 <item>When compiling without <tt/-Os/, the function is only available as
3773 fastcall function, so it may only be used in presence of a prototype.
3775 <tag/Availability/ISO 9899
3777 <ref id="isalnum" name="isalnum">,
3778 <ref id="isalpha" name="isalpha">,
3779 <ref id="isascii" name="isascii">,
3780 <ref id="isblank" name="isblank">,
3781 <ref id="iscntrl" name="iscntrl">,
3782 <ref id="isdigit" name="isdigit">,
3783 <ref id="isgraph" name="isgraph">,
3784 <ref id="islower" name="islower">,
3785 <ref id="isprint" name="isprint">,
3786 <ref id="ispunct" name="ispunct">,
3787 <ref id="isupper" name="isupper">,
3788 <ref id="isxdigit" name="isxdigit">
3794 <sect1>isupper<label id="isupper"><p>
3798 <tag/Function/Check if a given character is an upper case letter.
3799 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3800 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
3801 <tag/Description/The function returns a non zero value if the given argument
3802 is an upper case letter. The return value is zero if the character is anything
3804 <tag/Notes/<itemize>
3805 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3806 inline sequence generated by the macro will not work correctly for values
3807 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3808 this range. The non inline function may be accessed by <tt/#undef/'ing the
3810 <item>When compiling without <tt/-Os/, the function is only available as
3811 fastcall function, so it may only be used in presence of a prototype.
3813 <tag/Availability/ISO 9899
3815 <ref id="isalnum" name="isalnum">,
3816 <ref id="isalpha" name="isalpha">,
3817 <ref id="isascii" name="isascii">,
3818 <ref id="isblank" name="isblank">,
3819 <ref id="iscntrl" name="iscntrl">,
3820 <ref id="isdigit" name="isdigit">,
3821 <ref id="isgraph" name="isgraph">,
3822 <ref id="islower" name="islower">,
3823 <ref id="isprint" name="isprint">,
3824 <ref id="ispunct" name="ispunct">,
3825 <ref id="isspace" name="isspace">,
3826 <ref id="isxdigit" name="isxdigit">
3832 <sect1>isxdigit<label id="isxdigit"><p>
3836 <tag/Function/Check if a given character is a hexadecimal digit.
3837 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3838 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
3839 <tag/Description/The function returns a non zero value if the given argument
3840 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
3841 character is anything else.
3842 <tag/Notes/<itemize>
3843 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3844 inline sequence generated by the macro will not work correctly for values
3845 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3846 this range. The non inline function may be accessed by <tt/#undef/'ing the
3848 <item>When compiling without <tt/-Os/, the function is only available as
3849 fastcall function, so it may only be used in presence of a prototype.
3851 <tag/Availability/ISO 9899
3853 <ref id="isalnum" name="isalnum">,
3854 <ref id="isalpha" name="isalpha">,
3855 <ref id="isascii" name="isascii">,
3856 <ref id="isblank" name="isblank">,
3857 <ref id="iscntrl" name="iscntrl">,
3858 <ref id="isdigit" name="isdigit">,
3859 <ref id="isgraph" name="isgraph">,
3860 <ref id="islower" name="islower">,
3861 <ref id="isprint" name="isprint">,
3862 <ref id="ispunct" name="ispunct">,
3863 <ref id="isspace" name="isspace">,
3864 <ref id="isupper" name="isupper">
3870 <sect1>itoa<label id="itoa"><p>
3874 <tag/Function/Convert an integer into a string.
3875 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3876 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
3877 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
3878 <tt/radix/ as the base.
3879 <tag/Notes/<itemize>
3880 <item>There are no provisions to prevent a buffer overflow.
3881 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
3882 <item>The function is non standard, so it is not available in strict ANSI mode.
3883 You should probably use <tt/sprintf/ instead.
3884 <item>The function is only available as fastcall function, so it may only be
3885 used in presence of a prototype.
3887 <tag/Availability/cc65
3889 <ref id="atoi" name="atoi">,
3890 <ref id="atol" name="atol">,
3891 <ref id="ltoa" name="ltoa">,
3892 <ref id="ultoa" name="ultoa">,
3893 <ref id="utoa" name="utoa">
3899 <sect1>joy_count<label id="joy_count"><p>
3903 <tag/Function/Return the number of joysticks supported by the current driver.
3904 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3905 <tag/Declaration/<tt/unsigned char joy_count (void);/
3906 <tag/Description/The function returns a the number of joysticks supported
3907 by the current joystick driver.
3908 <tag/Notes/<itemize>
3909 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3910 name="joy_load_driver"> before calling this function.
3911 <item>The function returns the number of joysticks supported by the driver.
3912 There's no way to check for the number of actually connected joysticks.
3914 <tag/Availability/cc65
3916 <ref id="joy_load_driver" name="joy_load_driver">,
3917 <ref id="joy_read" name="joy_read">
3923 <sect1>joy_install<label id="joy_install"><p>
3927 <tag/Function/Install an already loaded driver and return an error code.
3928 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3929 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
3930 <tag/Description/The function installs a driver that was already loaded into
3931 memory (or linked statically to the program). It returns an error code
3932 (<tt/JOY_ERR_OK/ in case of success).
3933 <tag/Notes/<itemize>
3934 <item>The function is only available as fastcall function, so it may only be
3935 used in presence of a prototype.
3937 <tag/Availability/cc65
3939 <ref id="joy_load_driver" name="joy_load_driver">,
3940 <ref id="joy_uninstall" name="joy_uninstall">,
3941 <ref id="joy_unload" name="joy_unload">
3947 <sect1>joy_load_driver<label id="joy_load_driver"><p>
3951 <tag/Function/Load a driver from disk and install it.
3952 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3953 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
3954 <tag/Description/The function loads a driver with the given name from disk
3955 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
3956 driver was successfully loaded and installed.
3957 <tag/Notes/<itemize>
3958 <item>The function is only available as fastcall function, so it may only be
3959 used in presence of a prototype.
3961 <tag/Availability/cc65
3963 <ref id="joy_install" name="joy_install">,
3964 <ref id="joy_uninstall" name="joy_uninstall">,
3965 <ref id="joy_unload" name="joy_unload">
3971 <sect1>joy_read<label id="joy_read"><p>
3975 <tag/Function/Read the status of a joystick.
3976 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3977 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
3978 <tag/Description/The function reads the status bits for a joystick. The number
3979 of the joystick is passed as parameter. The result may be examined by using one
3980 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
3981 <tag/Notes/<itemize>
3982 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3983 name="joy_load_driver"> before calling this function.
3984 <item>The function is only available as fastcall function, so it may only be
3985 used in presence of a prototype.
3987 <tag/Availability/cc65
3989 <ref id="joy_count" name="joy_count">,
3990 <ref id="joy_load_driver" name="joy_load_driver">,
3991 <ref id="joy_unload" name="joy_unload">
3997 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4001 <tag/Function/Uninstall the current joystick driver.
4002 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4003 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4004 <tag/Description/The function uninstalls the currently installed joystick
4005 driver. It does not remove the driver from memory. The function returns an
4006 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4007 <tag/Notes/<itemize>
4008 <item>A joystick driver must be installed using <ref id="joy_install"
4009 name="joy_install"> before calling this function.
4011 <tag/Availability/cc65
4013 <ref id="joy_install" name="joy_install">,
4014 <ref id="joy_load_driver" name="joy_load_driver">,
4015 <ref id="joy_unload" name="joy_unload">
4021 <sect1>joy_unload<label id="joy_unload"><p>
4025 <tag/Function/Uninstall, then unload the current joystick driver.
4026 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4027 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4028 <tag/Description/The function uninstalls the currently installed joystick
4029 driver and removes it from memory. An error code is returned, which is
4030 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4031 <tag/Notes/<itemize>
4032 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4033 name="joy_load_driver"> before calling this function.
4035 <tag/Availability/cc65
4037 <ref id="joy_load_driver" name="joy_load_driver">
4043 <sect1>kbhit<label id="kbhit"><p>
4047 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4048 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4049 <tag/Declaration/<tt/unsigned char kbhit (void);/
4050 <tag/Description/The function returns a value of zero if there is no character
4051 waiting to be read from the keyboard. It returns non zero otherwise.
4052 <tag/Notes/<itemize>
4053 <item>If the system does not support a keyboard buffer (most systems
4054 do), the function is rather useless.
4056 <tag/Availability/cc65
4058 <ref id="cgetc" name="cgetc">,
4059 <ref id="cursor" name="cursor">
4065 <sect1>labs<label id="labs"><p>
4069 <tag/Function/Returns the absolute value of a long integer.
4070 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4071 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4072 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4074 <tag/Notes/<itemize>
4075 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4076 <item>The function is only available as fastcall function, so it may only be
4077 used in presence of a prototype.
4079 <tag/Availability/ISO 9899
4081 <ref id="abs" name="abs">
4087 <sect1>ltoa<label id="ltoa"><p>
4091 <tag/Function/Convert a long integer into a string.
4092 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4093 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4094 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4095 using <tt/radix/ as the base.
4096 <tag/Notes/<itemize>
4097 <item>There are no provisions to prevent a buffer overflow.
4098 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4099 <item>The function is non standard, so it is not available in strict ANSI mode.
4100 You should probably use <tt/sprintf/ instead.
4101 <item>The function is only available as fastcall function, so it may only be
4102 used in presence of a prototype.
4104 <tag/Availability/cc65
4106 <ref id="atoi" name="atoi">,
4107 <ref id="atol" name="atol">,
4108 <ref id="itoa" name="itoa">,
4109 <ref id="ultoa" name="ultoa">,
4110 <ref id="utoa" name="utoa">
4116 <sect1>localeconv<label id="localeconv"><p>
4120 <tag/Function/Returns a pointer to the current locale structure.
4121 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4122 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4123 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4125 <tag/Notes/<itemize>
4126 <item>cc65 supports only the "C" locale, so even after setting a new locale
4127 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4130 <tag/Availability/ISO 9899
4132 <ref id="setlocale" name="setlocale">
4138 <sect1>longjmp<label id="longjmp"><p>
4142 <tag/Function/Non local goto.
4143 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4144 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4145 <tag/Description/The <tt/longjmp/ function restores a program context from the
4146 data in <tt/buf/, which must have been set by a preceeding call to
4147 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4148 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4150 <tag/Notes/<itemize>
4151 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4152 was called with a value of one.
4153 <item>The function is only available as fastcall function, so it may only
4154 be used in presence of a prototype.
4156 <tag/Availability/ISO 9899
4158 <ref id="setjmp" name="setjmp">
4164 <sect1>malloc<label id="malloc"><p>
4168 <tag/Function/Allocate dynamic memory.
4169 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4170 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4171 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4172 pointer to the allocated memory block. On error (not enough memory available),
4173 <tt/malloc/ returns <tt/NULL/.
4174 <tag/Notes/<itemize>
4175 <item>The function is only available as fastcall function, so it may only
4176 be used in presence of a prototype.
4178 <tag/Availability/ISO 9899
4180 <ref id="_heapadd" name="_heapadd">,
4181 <ref id="_heapblocksize" name="_heapblocksize">,
4182 <ref id="_heapmaxavail" name="_heapmaxavail">,
4183 <ref id="_heapmemavail" name="_heapmemavail">,
4184 <ref id="calloc" name="calloc">,
4185 <ref id="free" name="free">,
4186 <ref id="realloc" name="realloc">,
4187 <ref id="strdup" name="strdup">
4193 <sect1>memchr<label id="memchr"><p>
4197 <tag/Function/Search for a character in a block of raw memory.
4198 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4199 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4200 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4201 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4202 that is of size <tt/count/. Upon completion, the function returns a pointer to
4203 the character found, or a null pointer if the character was not found.
4204 <tag/Notes/<itemize>
4205 <item>The function is only available as fastcall function, so it may only
4206 be used in presence of a prototype.
4208 <tag/Availability/ISO 9899
4210 <ref id="strchr" name="strchr">
4216 <sect1>memcmp<label id="memcmp"><p>
4220 <tag/Function/Compare two memory areas.
4221 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4222 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4223 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4224 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4225 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4226 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4227 <tag/Notes/<itemize>
4228 <item>The function is only available as fastcall function, so it may only
4229 be used in presence of a prototype.
4231 <tag/Availability/ISO 9899
4233 <ref id="strcmp" name="strcmp">,
4234 <ref id="memmove" name="memmove">,
4235 <ref id="memset" name="memset">
4241 <sect1>memcpy<label id="memcpy"><p>
4245 <tag/Function/Copy a memory area.
4246 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4247 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4248 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4249 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4251 <tag/Notes/<itemize>
4252 <item>The result is undefined if the memory areas do overlap. Use
4253 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4254 <item>The function is only available as fastcall function, so it may only
4255 be used in presence of a prototype.
4257 <tag/Availability/ISO 9899
4259 <ref id="_swap" name="_swap">,
4260 <ref id="memmove" name="memmove">,
4261 <ref id="memset" name="memset">
4267 <sect1>memmove<label id="memmove"><p>
4271 <tag/Function/Copy a memory area.
4272 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4273 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4274 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4275 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4277 <tag/Notes/<itemize>
4278 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4279 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4280 <item>The function is only available as fastcall function, so it may only
4281 be used in presence of a prototype.
4283 <tag/Availability/ISO 9899
4285 <ref id="_swap" name="_swap">,
4286 <ref id="memcpy" name="memcpy">,
4287 <ref id="memset" name="memset">
4293 <sect1>memset<label id="memset"><p>
4297 <tag/Function/Fill a memory area.
4298 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4299 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4300 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4301 the value <tt/val/. The function returns <tt/p/.
4302 <tag/Notes/<itemize>
4303 <item>The function is only available as fastcall function, so it may only
4304 be used in presence of a prototype.
4306 <tag/Availability/ISO 9899
4308 <ref id="_swap" name="_swap">,
4309 <ref id="bzero" name="bzero">,
4310 <ref id="memcpy" name="memcpy">,
4311 <ref id="memmove" name="memmove">
4317 <sect1>mod_free<label id="mod_free"><p>
4321 <tag/Function/Free a relocatable module.
4322 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4323 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4324 <tag/Description/The function will free a module loaded into memory by use of
4325 the <tt/<ref id="mod_load" name="mod_load">/ function.
4326 <tag/Notes/<itemize>
4327 <item>The pointer passed as parameter is the pointer to the module memory,
4328 not the pointer to the control structure.
4329 <item>The function is available only as a fastcall function; so, it may be used
4330 only in the presence of a prototype.
4332 <tag/Availability/cc65
4334 <ref id="mod_load" name="mod_load">
4340 <sect1>mod_load<label id="mod_load"><p>
4344 <tag/Function/Load a relocatable module.
4345 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4346 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4347 <tag/Description/The function will load a code module into memory and relocate
4348 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4349 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4350 the module just loaded. Possible error codes are:
4352 <item><tt/MLOAD_OK/ - Module load successful
4353 <item><tt/MLOAD_ERR_READ/ - Read error
4354 <item><tt/MLOAD_ERR_HDR/ - Header error
4355 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4356 <item><tt/MLOAD_ERR_FMT/ - Data format error
4357 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4359 <tag/Notes/<itemize>
4360 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4361 relocatable o65 modules for use with this function.
4362 <item>The function is available only as a fastcall function; so, it may be used
4363 only in the presence of a prototype.
4365 <tag/Availability/cc65
4367 <ref id="mod_free" name="mod_free">
4373 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4377 <tag/Function/Specify a bounding box for the mouse cursor.
4378 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4379 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4380 <tag/Description/The function allows to set a bounding box for mouse movement.
4381 <tag/Notes/<itemize>
4382 <item>The function does not check if the mouse cursor is currently within the
4383 given rectangle. Placing the mouse cursor within the bounding box is the
4384 responsibility of the programmer.
4385 <item>While the bounding box may be larger than the actual screen size, the
4386 standard mouse cursor draw routines may fail to set the cursor to coordinates
4387 outside of the screen area. Depending on the platform, you may have to supply
4388 your own mouse cursor routines.
4389 <item>The function is only available as fastcall function, so it may only be
4390 used in presence of a prototype.
4392 <tag/Availability/cc65
4394 <ref id="mouse_getbox" name="mouse_getbox">,
4395 <ref id="mouse_move" name="mouse_move">
4401 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4405 <tag/Function/Return the current bounding box for the mouse cursor.
4406 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4407 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4408 <tag/Description/The function queries the current bounding box for mouse
4410 <tag/Notes/<itemize>
4411 <item>The function is only available as fastcall function, so it may only be
4412 used in presence of a prototype.
4414 <tag/Availability/cc65
4416 <ref id="mouse_move" name="mouse_move">,
4417 <ref id="mouse_setbox" name="mouse_setbox">
4423 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4427 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4428 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4429 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4430 <tag/Description/The function returns a bit mask that encodes the state of the
4431 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4433 <tag/Availability/cc65
4435 <ref id="mouse_info" name="mouse_info">,
4436 <ref id="mouse_pos" name="mouse_pos">
4442 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4446 <tag/Function/Return a readable error message for an error code.
4447 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4448 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4450 <tag/Description/The function returns an error message (in english) for the
4451 error code passed parameter.
4452 <tag/Notes/<itemize>
4453 <item>The function will return "Unknown error" for invalid error codes.
4454 <item>The function is only available as fastcall function, so it may only be
4455 used in presence of a prototype.
4457 <tag/Availability/cc65
4459 <ref id="mouse_load_driver" name="mouse_load_driver">,
4460 <ref id="mouse_uninstall" name="mouse_uninstall">,
4461 <ref id="mouse_unload" name="mouse_unload">
4467 <sect1>mouse_hide<label id="mouse_hide"><p>
4471 <tag/Function/Hide the mouse pointer.
4472 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4473 <tag/Declaration/<tt/void mouse_hide (void);/
4474 <tag/Description/The function hides the mouse pointer. It manages a counter
4475 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4476 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4477 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4479 <tag/Availability/cc65
4481 <ref id="mouse_show" name="mouse_show">
4487 <sect1>mouse_info<label id="mouse_info"><p>
4491 <tag/Function/Return the state of the mouse buttons and the position of the
4493 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4494 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
4495 <tag/Description/The function returns the state of the mouse buttons and the
4496 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
4497 <tag/Notes/<itemize>
4498 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
4499 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
4500 name="mouse_pos">/ instead.
4501 <item>The function is only available as fastcall function, so it may only be
4502 used in presence of a prototype.
4504 <tag/Availability/cc65
4506 <ref id="mouse_buttons" name="mouse_buttons">,
4507 <ref id="mouse_pos" name="mouse_pos">
4513 <sect1>mouse_install<label id="mouse_install"><p>
4517 <tag/Function/Install an already loaded mouse driver.
4518 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4519 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
4520 mouse_callbacks* c, void* driver);/
4521 <tag/Description/The function installs an already loaded mouse driver and
4522 returns an error code. The <tt/mouse_callbacks/ structure passed as first
4523 parameter contains pointers to routines needed to move or hide/show the mouse
4524 pointer. Defaults for these routines are supplied by the library, so if you
4525 can live with these defaults (which are platform specific), just pass a
4526 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
4527 driver linked statically to the program.
4528 <tag/Notes/<itemize>
4529 <item>Not all drivers are able to detect if the supported hardware is really
4531 <item>After installing a driver, the mouse cursor is hidden.
4532 <item>The function is only available as fastcall function, so it may only be
4533 used in presence of a prototype.
4535 <tag/Availability/cc65
4537 <ref id="mouse_load_driver" name="mouse_load_driver">,
4538 <ref id="mouse_uninstall" name="mouse_uninstall">,
4539 <ref id="mouse_unload" name="mouse_unload">
4545 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
4549 <tag/Function/Call the driver specific ioctl function.
4550 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4551 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
4552 <tag/Description/The function calls the IOCTL entry in the mouse driver,
4553 which is driver specific. The <tt/code/ parameter will choose between
4554 different IOCTL functions, and the <tt/data/ depends on code. The
4555 function returns an error code. The purpose of this function is to allow
4556 for driver specific extensions. See the documentation for a specific mouse
4557 driver for supported ioctl calls.
4558 <tag/Notes/<itemize>
4559 <item>Calling this function is non portable, because each driver may
4560 implement different ioctl calls (or none at all).
4561 <item>The function is only available as fastcall function, so it may only be
4562 used in presence of a prototype.
4564 <tag/Availability/cc65
4570 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
4574 <tag/Function/Load and initialize a mouse driver.
4575 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4576 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
4577 mouse_callbacks* c, const char* driver);/
4578 <tag/Description/Load a mouse driver into memory and initialize it. The
4579 function returns an error code that tells if the call has been successful. The
4580 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
4581 routines needed to move or hide/show the mouse pointer. Defaults for these
4582 routines are supplied by the library, so if you can live with these defaults
4583 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
4584 <tag/Notes/<itemize>
4585 <item>The driver is loaded by name, so currently you must know the type of
4586 mouse that should be supported. There is no autodetect capability.
4587 <item>Not all drivers are able to detect if the supported hardware is really
4589 <item>After installing a driver, the mouse cursor is hidden.
4590 <item>The function is only available as fastcall function, so it may only be
4591 used in presence of a prototype.
4593 <tag/Availability/cc65
4595 <ref id="mouse_install" name="mouse_install">,
4596 <ref id="mouse_uninstall" name="mouse_uninstall">,
4597 <ref id="mouse_unload" name="mouse_unload">
4603 <sect1>mouse_move<label id="mouse_move"><p>
4607 <tag/Function/Move the mouse cursor to a specific position.
4608 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4609 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
4610 <tag/Description/The function updates the mouse position. If the mouse cursor
4611 is visible, it is shown at the new position.
4612 <tag/Notes/<itemize>
4613 <item>The function does not check if the new position is within the bounding
4614 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
4615 <item>The function is only available as fastcall function, so it may only be
4616 used in presence of a prototype.
4618 <tag/Availability/cc65
4620 <ref id="mouse_getbox" name="mouse_getbox">,
4621 <ref id="mouse_setbox" name="mouse_setbox">
4627 <sect1>mouse_pos<label id="mouse_pos"><p>
4631 <tag/Function/Return the position of the mouse.
4632 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4633 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
4634 <tag/Description/The function returns the position of the mouse in the
4635 <tt/mouse_pos/ structure passed as parameter.
4636 <tag/Notes/<itemize>
4637 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
4638 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
4639 name="mouse_info">/ instead.
4640 <item>The function is only available as fastcall function, so it may only be
4641 used in presence of a prototype.
4643 <tag/Availability/cc65
4645 <ref id="mouse_buttons" name="mouse_buttons">,
4646 <ref id="mouse_info" name="mouse_info">
4652 <sect1>mouse_show<label id="mouse_show"><p>
4656 <tag/Function/Show the mouse pointer.
4657 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4658 <tag/Declaration/<tt/void mouse_show (void);/
4659 <tag/Description/The function shows the mouse pointer. It manages a counter
4660 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
4661 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
4662 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
4663 <tag/Availability/cc65
4665 <ref id="mouse_hide" name="mouse_hide">
4671 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
4675 <tag/Function/Uninstall an already loaded mouse driver.
4676 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4677 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
4678 <tag/Description/The function uninstalls an already loaded mouse driver but
4679 don't removes it from memory.
4680 <tag/Notes/<itemize>
4681 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
4682 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
4683 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
4686 <tag/Availability/cc65
4688 <ref id="mouse_install" name="mouse_install">,
4689 <ref id="mouse_load_driver" name="mouse_load_driver">,
4690 <ref id="mouse_unload" name="mouse_unload">
4696 <sect1>mouse_unload<label id="mouse_unload"><p>
4700 <tag/Function/Unload a mouse driver.
4701 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4702 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
4703 <tag/Description/The function unloads a loaded mouse driver and frees all
4704 memory allocated for the driver.
4705 <tag/Notes/<itemize>
4706 <item>The function does nothing if no driver is loaded.
4708 <tag/Availability/cc65
4710 <ref id="mouse_install" name="mouse_install">,
4711 <ref id="mouse_load_driver" name="mouse_load_driver">,
4712 <ref id="mouse_uninstall" name="mouse_uninstall">
4718 <sect1>offsetof<label id="offsetof"><p>
4722 <tag/Function/Calculate the offset of a struct or union member.
4723 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
4724 <tag/Declaration/<tt/size_t offsetof (type, member);/
4725 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
4726 or <tt/union/ member.
4727 <tag/Notes/<itemize>
4728 <item>The function is actually a macro.
4730 <tag/Availability/ISO 9899
4736 <sect1>open<label id="open"><p>
4740 <tag/Function/Open and possibly create a file.
4741 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
4742 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
4743 <tag/Description/<tt/open/ opens a file and returns the file descriptor
4744 associated with it. On error, -1 is returned and an error code is stored in
4745 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
4746 <tag/Notes/<itemize>
4747 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
4748 open, which is used as the permission mask when a new file is created. While
4749 cc65 allows to pass this argument, it is ignored.
4751 <tag/Availability/POSIX 1003.1
4753 <ref id="close" name="close">,
4754 <ref id="creat" name="creat">
4760 <sect1>opendir<label id="opendir"><p>
4764 <tag/Function/Open a directory.
4765 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
4766 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
4767 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
4768 descriptor associated with it. On error, NULL is returned and an error code is
4769 stored in <tt/errno/.
4770 <tag/Notes/<itemize>
4771 <item>The function is only available as fastcall function, so it may only
4772 be used in presence of a prototype.
4774 <tag/Availability/POSIX 1003.1
4776 <ref id="closedir" name="closedir">,
4777 <ref id="readdir" name="readdir">
4783 <sect1>peekbsys<label id="peekbsys"><p>
4787 <tag/Function/Read one byte from a location in the system bank.
4788 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4789 <tt/<ref id="cbm510.h" name="cbm510.h">/
4790 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
4791 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
4792 system bank (bank 15) of the CBM PET-II machines and returns it.
4793 <tag/Notes/<itemize>
4794 <item>The function is only available as fastcall function, so it may only
4795 be used in presence of a prototype.
4796 <item>This function may be a macro depending on the compiler options. The
4797 actual function is accessible by #undef'ing the macro.
4799 <tag/Availability/cc65
4801 <ref id="PEEK" name="PEEK">,
4802 <ref id="PEEKW" name="PEEKW">,
4803 <ref id="peekwsys" name="peekwsys">,
4804 <ref id="pokebsys" name="pokebsys">,
4805 <ref id="pokewsys" name="pokewsys">
4811 <sect1>peekwsys<label id="peekwsys"><p>
4815 <tag/Function/Read one word from a location in the system bank.
4816 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4817 <tt/<ref id="cbm510.h" name="cbm510.h">/
4818 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
4819 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
4820 system bank (bank 15) of the CBM PET-II machines and returns it. Following
4821 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
4822 high byte is read from <tt/addr+1/.
4823 <tag/Notes/<itemize>
4824 <item>The function is only available as fastcall function, so it may only
4825 be used in presence of a prototype.
4826 <item>The order in which the two bytes are read is undefined.
4828 <tag/Availability/cc65
4830 <ref id="PEEK" name="PEEK">,
4831 <ref id="PEEKW" name="PEEKW">,
4832 <ref id="peekbsys" name="peekbsys">,
4833 <ref id="pokebsys" name="pokebsys">,
4834 <ref id="pokewsys" name="pokewsys">
4840 <sect1>perror<label id="perror"><p>
4844 <tag/Function/Print an error message for the error in <tt/errno/.
4845 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4846 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
4847 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
4848 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
4849 a blank. Then the error message for the current contents of <tt/errno/ is
4850 printed followed by a newline. The message output is the same as returned by
4851 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
4852 <tag/Notes/<itemize>
4853 <item>The function is only available as fastcall function, so it may only
4854 be used in presence of a prototype.
4856 <tag/Availability/ISO 9899
4858 <ref id="_poserror" name="_poserror">,
4859 <ref id="strerror" name="strerror">
4865 <sect1>pokebsys<label id="pokebsys"><p>
4869 <tag/Function/Write one byte to a location in the system bank.
4870 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4871 <tt/<ref id="cbm510.h" name="cbm510.h">/
4872 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
4873 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
4874 system bank (bank 15) of the CBM PET-II machines.
4875 <tag/Notes/<itemize>
4876 <item>The function is only available as fastcall function, so it may only
4877 be used in presence of a prototype.
4879 <tag/Availability/cc65
4881 <ref id="POKE" name="POKE">,
4882 <ref id="POKEW" name="POKEW">,
4883 <ref id="peekbsys" name="peekbsys">,
4884 <ref id="peekwsys" name="peekwsys">,
4885 <ref id="pokewsys" name="pokewsys">
4891 <sect1>pokewsys<label id="pokewsys"><p>
4895 <tag/Function/Write one word to a location in the system bank.
4896 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4897 <tt/<ref id="cbm510.h" name="cbm510.h">/
4898 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
4899 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
4900 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
4901 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
4902 high byte is written to <tt/addr+1/.
4903 <tag/Notes/<itemize>
4904 <item>The function is only available as fastcall function, so it may only
4905 be used in presence of a prototype.
4906 <item>The order in which the two bytes are written is undefined.
4908 <tag/Availability/cc65
4910 <ref id="POKE" name="POKE">,
4911 <ref id="POKEW" name="POKEW">,
4912 <ref id="peekbsys" name="peekbsys">,
4913 <ref id="peekwsys" name="peekwsys">,
4914 <ref id="pokebsys" name="pokebsys">
4920 <sect1>qsort<label id="qsort"><p>
4924 <tag/Function/Sort an array.
4925 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4926 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
4927 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
4928 <tag/Description/<tt/qsort/ sorts an array according to a given compare
4929 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
4930 is the number of elements, <tt/size/ the size of an element and <tt/compare/
4931 the function used to compare the members.
4932 <tag/Notes/<itemize>
4933 <item>If there are multiple members with the same key, the order after calling
4934 the function is undefined.
4935 <item>The function is only available as fastcall function, so it may only
4936 be used in presence of a prototype.
4937 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
4940 <tag/Availability/ISO 9899
4942 <ref id="bsearch" name="bsearch">
4948 <sect1>raise<label id="raise"><p>
4952 <tag/Function/Send a signal to the executing program.
4953 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4954 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
4955 <tag/Description/<tt/raise/ sends the given signal to the program. If the
4956 program has installed a signal handler for the signal, this signal handler
4957 will be executed. If no handler has been installed, the default action for
4958 the raised signal will be taken. The function returns zero on success,
4960 <tag/Notes/<itemize>
4961 <item>The function is only available as fastcall function, so it may only
4962 be used in presence of a prototype.
4964 <tag/Availability/ISO 9899
4966 <ref id="abort" name="abort">,
4967 <ref id="signal" name="signal">
4973 <sect1>rand<label id="rand"><p>
4977 <tag/Function/Return a pseudo random number.
4978 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4979 <tag/Declaration/<tt/int rand (void);/
4980 <tag/Description/The function returns a pseudo random number
4981 between 0 and <tt/RAND_MAX/ (exclusive).
4982 <tag/Notes/<itemize>
4983 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
4984 flow of numbers is generated.
4985 <item>On startup, the function behaves as if <ref id="srand" name="srand">
4986 had been used with an argument of 1.
4988 <tag/Availability/ISO 9899
4990 <ref id="_randomize" name="_randomize">,
4991 <ref id="srand" name="srand">
4997 <sect1>readdir<label id="readdir"><p>
5001 <tag/Function/Read a directory.
5002 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5003 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5004 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5005 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5006 and returns a pointer to it. If the end of directory is reached, or an error
5007 occurs, NULL is returned. In case of errors, an error code is stored into
5009 <tag/Notes/<itemize>
5010 <item>The function is only available as fastcall function, so it may only
5011 be used in presence of a prototype.
5012 <item>The returned pointer may point to a statically allocated instance of
5013 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5015 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5016 confused when opening/closing files between directory reads. So for example a
5017 program that reads the list of files on a disk, and after each call to
5018 <tt/readdir/, opens the file to process it, will fail.<newline>
5019 Possible solutions are reading the directory into memory before processing the
5020 file list, or to reset the directory by seeking to the correct position after
5021 opening/closing a file:
5023 seekdir (DIR, telldir (DIR));
5025 Platforms known to work without problems are: Apple.
5027 <tag/Availability/POSIX 1003.1
5029 <ref id="closedir" name="closedir">,
5030 <ref id="opendir" name="opendir">
5036 <sect1>realloc<label id="realloc"><p>
5040 <tag/Function/Change the size of an allocated memory block.
5041 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5042 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5043 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5044 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5045 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5046 behaves as if <tt/free/ had been called. On error (not enough memory
5047 available), <tt/realloc/ returns <tt/NULL/.
5048 <tag/Notes/<itemize>
5049 <item>The part of the memory block that is returned will have its contents
5051 <item>This function is somewhat dangerous to use. Be careful to save the
5052 pointer you're passing somewhere else, otherwise
5054 ptr = realloc (ptr, size);
5056 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5057 <item>The function is only available as fastcall function, so it may only
5058 be used in presence of a prototype.
5060 <tag/Availability/ISO 9899
5062 <ref id="_heapadd" name="_heapadd">,
5063 <ref id="_heapblocksize" name="_heapblocksize">,
5064 <ref id="_heapmaxavail" name="_heapmaxavail">,
5065 <ref id="_heapmemavail" name="_heapmemavail">,
5066 <ref id="calloc" name="calloc">,
5067 <ref id="free" name="free">,
5068 <ref id="realloc" name="realloc">
5074 <sect1>remove<label id="remove"><p>
5078 <tag/Function/Delete a file.
5079 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5080 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5081 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5082 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5083 code describing the reason for the failure.
5084 <tag/Notes/<itemize>
5085 <item>This function is not available on all cc65 targets (depends on the
5086 availability of file I/O).
5087 <item>The function is only available as fastcall function, so it may only
5088 be used in presence of a prototype.
5090 <tag/Availability/ISO 9899
5092 <ref id="rename" name="rename">,
5093 <ref id="unlink" name="unlink">
5096 #include <stdio.h>
5098 #define FILENAME "helloworld"
5100 if (remove (FILENAME) == 0) {
5101 printf ("We deleted %s successfully\n", FILENAME);
5103 printf ("There was a problem deleting %s\n", FILENAME);
5110 <sect1>rename<label id="rename"><p>
5114 <tag/Function/Rename a file.
5115 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5116 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5117 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5118 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5119 code describing the reason for the failure.
5120 <tag/Notes/<itemize>
5121 <item>This function is not available on all cc65 targets (depends on the
5122 capabilities of the storage devices).
5123 <item>The function is only available as fastcall function, so it may only
5124 be used in presence of a prototype.
5126 <tag/Availability/ISO 9899
5128 <ref id="remove" name="remove">
5131 #include <stdio.h>
5133 #define OLDNAME "textfile.txt"
5134 #define NEWNAME "textfile.bak"
5136 if (rename (OLDNAME, NEWNAME) == 0) {
5137 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5139 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5146 <sect1>reset_brk<label id="reset_brk"><p>
5150 <tag/Function/Resets the break vector to its original value.
5151 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5152 <tag/Declaration/<tt/void reset_brk (void);/
5153 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5154 before a call to <tt/set_brk/.
5155 <tag/Notes/<itemize>
5156 <item>The break vector is reset on program termination, so it's not strictly
5157 necessary to call this function as a part of your clean-up when exitting the program.
5159 <tag/Availability/cc65
5161 <ref id="reset_irq" name="reset_irq">,
5162 <ref id="set_brk" name="set_brk">,
5163 <ref id="set_irq" name="set_irq">
5169 <sect1>reset_irq<label id="reset_irq"><p>
5173 <tag/Function/Resets the C level interrupt request vector.
5174 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5175 <tag/Declaration/<tt/void reset_irq (void);/
5176 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5177 <tag/Notes/<itemize>
5178 <item>The interrupt vector is reset on program termination, so it's not strictly
5179 necessary to call this function as a part of your clean-up when exitting the program.
5181 <tag/Availability/cc65
5183 <ref id="reset_brk" name="reset_brk">,
5184 <ref id="set_brk" name="set_brk">,
5185 <ref id="set_irq" name="set_irq">
5191 <sect1>revers<label id="revers"><p>
5195 <tag/Function/Control revers character display.
5196 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5197 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5198 <tag/Description/If the argument is non zero, the function enables reverse
5199 character display. If the argument is zero, reverse character display is
5200 switched off. The old value of the setting is returned.
5201 <tag/Notes/<itemize>
5202 <item>The function may not be supported by the hardware, in which case
5203 the call is ignored.
5204 <item>The function is only available as fastcall function, so it may only
5205 be used in presence of a prototype.
5207 <tag/Availability/cc65
5209 <ref id="textcolor" name="textcolor">
5215 <sect1>rewinddir<label id="rewinddir"><p>
5219 <tag/Function/Reset a directory stream.
5220 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5221 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5222 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5223 pointed to by <tt/dir/ to the start of the directory.
5224 <tag/Notes/<itemize>
5225 <item>The function is only available as fastcall function, so it may only
5226 be used in presence of a prototype.
5228 <tag/Availability/POSIX 1003.1
5230 <ref id="seekdir" name="seekdir">,
5231 <ref id="telldir" name="telldir">
5237 <sect1>screensize<label id="screensize"><p>
5241 <tag/Function/Return the dimensions of the text mode screen.
5242 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5243 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5244 <tag/Description/The function returns the dimensions of the text mode screen.
5245 <tag/Notes/<itemize>
5246 <item>The function is only available as fastcall function, so it may only
5247 be used in presence of a prototype.
5249 <tag/Availability/cc65
5251 <ref id="gotox" name="gotox">,
5252 <ref id="gotoxy" name="gotoxy">,
5253 <ref id="gotoy" name="gotoy">,
5254 <ref id="wherex" name="wherex">,
5255 <ref id="wherey" name="wherey">
5261 <sect1>seekdir<label id="seekdir"><p>
5265 <tag/Function/Set the position of a directory stream.
5266 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5267 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5268 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5269 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5270 value returned by <tt/<ref id="telldir" name="telldir">/.
5271 <tag/Notes/<itemize>
5272 <item>The function is only available as fastcall function, so it may only
5273 be used in presence of a prototype.
5275 <tag/Availability/POSIX 1003.1
5277 <ref id="rewinddir" name="rewinddir">,
5278 <ref id="telldir" name="telldir">
5284 <sect1>ser_close<label id="ser_close"><p>
5288 <tag/Function/Close the port and disable interrupts
5289 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5290 <tag/Declaration/<tt/unsigned char ser_close (void);/
5291 <tag/Description/Close the port by clearing buffers and disable interrupts.
5292 <tag/Availability/cc65
5293 <tag/See also/Other serial functions.
5298 static void initialize(){
5299 struct ser_params params = {
5306 ser_install(lynx_comlynx); // This will activate the ComLynx
5308 ser_open(&params);
5315 <sect1>ser_get<label id="ser_get"><p>
5319 <tag/Function/Read a character from serial port.
5320 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5321 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5322 <tag/Description/Get a character from the serial port. If no characters are
5323 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5325 <tag/Notes/<itemize>
5326 <item>The function is only available as fastcall function, so it may only
5327 be used in presence of a prototype.
5329 <tag/Availability/cc65
5330 <tag/See also/Other serial functions.
5332 Wait for a character to be available from a serial port.
5335 while (ser_get(&ch) == SER_ERR_NO_DATA)
5342 <sect1>ser_install<label id="ser_install"><p>
5346 <tag/Function/Install an already loaded driver and return an error code.
5347 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5348 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5349 <tag/Description/The function installs a driver that was already loaded into
5350 memory (or linked statically to the program). It returns an error code
5351 (<tt/SER_ERR_OK/ in case of success).
5352 <tag/Notes/<itemize>
5353 <item>The function is only available as fastcall function, so it may only be
5354 used in presence of a prototype.
5356 <tag/Availability/cc65
5358 <ref id="ser_load_driver" name="ser_load_driver">,
5359 <ref id="ser_uninstall" name="ser_uninstall">,
5360 <ref id="ser_unload" name="ser_unload">
5362 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5368 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5372 <tag/Function/Platform dependent code extensions.
5373 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5374 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5375 <tag/Description/Some platforms have extra serial functions that are not
5376 supported by standard serial driver functions. You can extend the driver to support
5377 this extra functionality bt using ser_ioctl functions.
5378 <tag/Notes/<itemize>
5379 <item>The function is only available as fastcall function, so it may only
5380 be used in presence of a prototype.
5381 <item>These functions are not easily portable to other cc65 platforms.
5383 <tag/Availability/cc65
5384 <tag/See also/Other serial functions.
5389 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5393 <tag/Function/Load and install a serial driver.
5394 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5395 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5396 <tag/Description/Load and install the driver by name.
5397 Will just load the driver and check if loading was successful.
5398 <tag/Notes/<itemize>
5399 <item>The function is only available as fastcall function, so it may only
5400 be used in presence of a prototype.
5402 <tag/Availability/cc65
5403 <tag/See also/Other serial functions.
5409 <sect1>ser_open<label id="ser_open"><p>
5413 <tag/Function/Open the port by setting the port parameters and enable interrupts
5414 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5415 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5416 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5417 <tag/Notes/<itemize>
5418 <item>The function is only available as fastcall function, so it may only
5419 be used in presence of a prototype.
5421 <tag/Availability/cc65
5422 <tag/See also/Other serial functions.
5427 static void initialize(){
5428 struct ser_params params = {
5435 ser_install(lynx_comlynx); // This will activate the ComLynx
5437 ser_open(&params);
5444 <sect1>ser_put<label id="ser_put"><p>
5448 <tag/Function/Write a character to a serial port.
5449 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5450 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5451 <tag/Description/Send a character via the serial port. There is a transmit
5452 buffer, but transmitting is not done via interrupt. The function returns
5453 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5454 <tag/Notes/<itemize>
5455 <item>The function is only available as fastcall function, so it may only
5456 be used in presence of a prototype.
5458 <tag/Availability/cc65
5459 <tag/See also/Other serial functions.
5468 <sect1>ser_status<label id="ser_status"><p>
5472 <tag/Function/Return the serial port status.
5473 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5474 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5475 <tag/Description/Return the serial port status.
5476 <tag/Notes/<itemize>
5477 <item>The function is only available as fastcall function, so it may only
5478 be used in presence of a prototype.
5480 <tag/Availability/cc65
5481 <tag/See also/Other serial functions.
5487 <sect1>ser_uninstall<label id="ser_uninstall"><p>
5491 <tag/Function/Uninstall the currently loaded driver but do not unload it.
5492 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5493 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
5494 <tag/Description/Uninstall the currently loaded driver but do not unload it.
5495 <tag/Availability/cc65
5496 <tag/See also/Other serial functions.
5501 <sect1>ser_unload<label id="ser_unload"><p>
5505 <tag/Function/Uninstall, then unload the currently loaded driver.
5506 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5507 <tag/Declaration/<tt/unsigned char ser_unload (void);/
5508 <tag/Description/Uninstall, then unload the currently loaded driver.
5509 <tag/Availability/cc65
5510 <tag/See also/Other serial functions.
5516 <sect1>set_brk<label id="set_brk"><p>
5520 <tag/Function/Set the break vector to a user function.
5521 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5522 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
5523 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
5524 program code by letting the vector point to a user written C function. The
5525 runtime library installs a small stub that saves the registers into global
5526 variables that may be accessed (and changed) by the break handler.
5527 <tag/Notes/<itemize>
5528 <item>The function is only available as fastcall function, so it may only
5529 be used in presence of a prototype.
5530 <item>The stub saves the zero page registers used by the C runtime and switches
5531 to a small break handler stack. This means that it is safe to execute C code,
5532 even if C code was interrupted. Be careful however not to use too many local
5533 variables, and do not enable stack checks for the handler function or any other
5534 function called from it.
5535 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
5536 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
5537 otherwise the <tt/BRK/ instruction will get executed over and over again.
5538 <item>The break vector is reset on program termination, so it's not strictly
5539 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
5540 clean-up when exitting the program.
5542 <tag/Availability/cc65
5544 <ref id="reset_brk" name="reset_brk">
5550 <sect1>set_irq<label id="set_irq"><p>
5554 <tag/Function/Set the C level interrupt request vector to the given address.
5555 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5556 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
5557 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
5558 (IRQs) within the program code by letting the vector point to a user written C
5559 function. The runtime library installs a small stub that saves the zero page
5560 registers used by the C runtime before calling the handler function and restores
5561 them after the handler function returns. Additionally the stub temporarily switches
5562 the C runtime stack to the stack area provided as parameter. If the handler function
5563 was set up to handle a "private", "exclusive" interrupt request source it must
5564 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
5565 interrupt request actually stems from that source. In all other cases it must return
5566 the value <tt/IRQ_NOT_HANDLED/.
5567 <tag/Notes/<itemize>
5568 <item>The function is only available as fastcall function, so it may only
5569 be used in presence of a prototype.
5570 <item>The stub saves the registers and zero page locations used by the C runtime
5571 and switches to the provided stack area. As a consequence, there is some
5572 runtime overhead, but it it is safe to execute C code, even if other C code
5573 was interrupted. Be careful however not to call C library functions, and do not
5574 enable stack checks for the handler function or any other function called from
5576 <item>The interrupt vector is reset on program termination, so it's not strictly
5577 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
5578 clean-up when exitting the program.
5580 <tag/Availability/cc65
5582 <ref id="reset_brk" name="reset_brk">,
5583 <ref id="reset_irq" name="reset_irq">,
5584 <ref id="set_brk" name="set_brk">
5590 <sect1>setjmp<label id="setjmp"><p>
5594 <tag/Function/Save the context for use with <tt/longjmp/.
5595 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
5596 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
5597 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
5598 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
5600 <tag/Notes/<itemize>
5601 <item>The function is only available as fastcall function, so it may only
5602 be used in presence of a prototype.
5603 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
5604 <item><tt/setjmp/ will not save the signal context.
5606 <tag/Availability/ISO 9899
5608 <ref id="longjmp" name="longjmp">
5614 <sect1>setlocale<label id="setlocale"><p>
5618 <tag/Function/Selects a locale.
5619 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
5620 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
5621 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
5622 <tag/Notes/<itemize>
5623 <item>The function is only available as fastcall function, so it may only
5624 be used in presence of a prototype.
5625 <item>cc65 supports only the "C" locale, so calling this function to set a
5626 different locale has no effect.
5628 <tag/Availability/ISO 9899
5630 <ref id="localeconv" name="localeconv">,
5631 <ref id="strcoll" name="strcoll">
5632 <ref id="strxfrm" name="strxfrm">
5638 <sect1>signal<label id="signal"><p>
5642 <tag/Function/Install a signal handler.
5643 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5644 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
5645 <tag/Description/<tt/signal/ installs a handler for the given signal. The
5646 handler may either be a user supplied function, or one of the predefined
5647 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
5648 previous value if the signal , or the special function vector SIG_ERR in
5650 <tag/Notes/<itemize>
5651 <item>The function is only available as fastcall function, so it may only
5652 be used in presence of a prototype.
5654 <tag/Availability/ISO 9899
5656 <ref id="abort" name="abort">,
5657 <ref id="raise" name="raise">
5663 <sect1>sleep<label id="sleep"><p>
5667 <tag/Function/Sleep for a specified amount of time.
5668 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
5669 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
5670 <tag/Description/The function will return after the specified number of
5671 seconds have elapsed.
5672 <tag/Notes/<itemize>
5673 <item>The function is only available as fastcall function, so it may only
5674 be used in presence of a prototype.
5676 <tag/Availability/POSIX 1003.1
5682 <sect1>slow<label id="slow"><p>
5686 <tag/Function/Switch the C128 into 1MHz mode.
5687 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
5688 <tag/Declaration/<tt/void slow (void);/
5689 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
5690 will halve the speed compared to fast mode.
5691 <tag/Notes/<itemize>
5692 <item>The function is specific to the C128.
5694 <tag/Availability/C128
5696 <ref id="fast" name="fast">,
5697 <ref id="toggle_videomode" name="toggle_videomode">,
5698 <ref id="videomode" name="videomode">
5704 <sect1>srand<label id="srand"><p>
5708 <tag/Function/Initialize the pseudo random number generator.
5709 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5710 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
5711 <tag/Description/The function initializes the random number generator using
5712 the given seed. On program startup, the generator behaves as if <tt/srand/ has
5713 been called with an argument of 1.
5714 <tag/Notes/<itemize>
5715 <item>The function is only available as fastcall function, so it may only
5716 be used in presence of a prototype.
5718 <tag/Availability/ISO 9899
5720 <ref id="_randomize" name="_randomize">,
5721 <ref id="rand" name="rand">
5727 <sect1>strcasecmp<label id="strcasecmp"><p>
5731 <tag/Function/Compare two strings case insensitive.
5732 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5733 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
5734 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
5735 as parameters without case sensitivity. It returns a value that is less than
5736 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
5737 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
5738 <tag/Notes/<itemize>
5739 <item>The function is only available as fastcall function, so it may only
5740 be used in presence of a prototype.
5741 <item>The function is not available in strict ANSI mode.
5743 <tag/Availability/cc65
5745 <ref id="strcmp" name="strcmp">,
5746 <ref id="strcoll" name="strcoll">,
5747 <ref id="stricmp" name="stricmp">,
5748 <ref id="strncmp" name="strncmp">,
5749 <ref id="strxfrm" name="strxfrm">
5755 <sect1>strcat<label id="strcat"><p>
5759 <tag/Function/Concatentate two strings.
5760 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5761 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
5762 <tag/Description/The <tt/strcat/ function appends a copy of the string
5763 pointed to by s2 (including the terminating null byte) to the end of the
5764 string pointed to by s1. The initial byte of s2 overwrites the null byte at
5766 <tag/Notes/<itemize>
5767 <item>The function is only available as fastcall function, so it may only
5768 be used in presence of a prototype.
5769 <item>If copying takes place between objects that overlap, the behaviour
5772 <tag/Availability/ISO 9899
5774 <ref id="strcpy" name="strcpy">,
5775 <ref id="strncat" name="strncat">,
5776 <ref id="strncpy" name="strncpy">
5782 <sect1>strchr<label id="strchr"><p>
5786 <tag/Function/Search for a character in a string.
5787 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5788 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
5789 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
5790 (converted to a char) in the string pointed to by <tt/s/. The terminating null
5791 byte is considered to be part of the string. Upon completion, the function
5792 returns a pointer to the byte, or a null pointer if the byte was not found.
5793 <tag/Notes/<itemize>
5794 <item>The function is only available as fastcall function, so it may only
5795 be used in presence of a prototype.
5797 <tag/Availability/ISO 9899
5799 <ref id="memchr" name="memchr">,
5800 <ref id="strrchr" name="strrchr">
5806 <sect1>strcmp<label id="strcmp"><p>
5810 <tag/Function/Compare two strings.
5811 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5812 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
5813 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
5814 parameters. It returns a value that is less than zero if <tt/s1/ is less than
5815 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
5816 if <tt/s1/ is greater than <tt/s2/.
5817 <tag/Notes/<itemize>
5818 <item>The function is only available as fastcall function, so it may only
5819 be used in presence of a prototype.
5821 <tag/Availability/ISO 9899
5823 <ref id="strcasecmp" name="strcasecmp">,
5824 <ref id="strcoll" name="strcoll">,
5825 <ref id="stricmp" name="stricmp">,
5826 <ref id="strncmp" name="strncmp">
5827 <ref id="strxfrm" name="strxfrm">
5833 <sect1>strcoll<label id="strcoll"><p>
5837 <tag/Function/Compare two strings.
5838 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5839 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
5840 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
5841 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
5842 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
5843 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
5844 than zero if <tt/s1/ is greater than <tt/s2/.
5845 <tag/Notes/<itemize>
5846 <item>The function is only available as fastcall function, so it may only
5847 be used in presence of a prototype.
5849 <tag/Availability/ISO 9899
5851 <ref id="setlocale" name="setlocale">,
5852 <ref id="strcasecmp" name="strcasecmp">,
5853 <ref id="strcmp" name="strcmp">,
5854 <ref id="stricmp" name="stricmp">,
5855 <ref id="strncmp" name="strncmp">,
5856 <ref id="strxfrm" name="strxfrm">
5862 <sect1>strcpy<label id="strcpy"><p>
5866 <tag/Function/Copy a string.
5867 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5868 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
5869 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
5870 <tt/s2/ (including the terminating null byte) into the array pointed to by
5871 <tt/s1/. The function will always return <tt/s1/.
5872 <tag/Notes/<itemize>
5873 <item>The function is only available as fastcall function, so it may only
5874 be used in presence of a prototype.
5875 <item>If copying takes place between objects that overlap, the behaviour
5878 <tag/Availability/ISO 9899
5880 <ref id="strcat" name="strcat">,
5881 <ref id="strncat" name="strncat">,
5882 <ref id="strncpy" name="strncpy">
5885 #include <string.h>
5887 static char hello[14];
5889 strcpy (hello, "Hello world!\n");
5895 <sect1>strcspn<label id="strcspn"><p>
5899 <tag/Function/Compute the length of a substring.
5900 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5901 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
5902 <tag/Description/The <tt/strcspn/ function computes and returns the length of
5903 the substring pointed to by <tt/s/ which does <em>not</em> consist of
5904 characters contained in the string <tt/set/.
5905 <tag/Notes/<itemize>
5906 <item>The function is only available as fastcall function, so it may only
5907 be used in presence of a prototype.
5909 <tag/Availability/ISO 9899
5911 <ref id="strqtok" name="strqtok">,
5912 <ref id="strspn" name="strspn">,
5913 <ref id="strstr" name="strstr">,
5914 <ref id="strtok" name="strtok">
5920 <sect1>strdup<label id="strdup"><p>
5924 <tag/Function/Allocate a copy of a string on the heap.
5925 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5926 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
5927 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
5928 to hold a copy of <tt/s/ including the terminating zero. If the allocation
5929 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
5930 memory block, and a pointer to the block is returned.
5931 <tag/Notes/<itemize>
5932 <item>The function is only available as fastcall function, so it may only
5933 be used in presence of a prototype.
5934 <item>It is up to the caller to free the allocated memory block.
5936 <tag/Availability/ISO 9899
5938 <ref id="free" name="free">,
5939 <ref id="malloc" name="malloc">
5945 <sect1>strerror<label id="strerror"><p>
5949 <tag/Function/Return a string describing an error code.
5950 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5951 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
5952 <tag/Description/The <tt/strerror/ function returns a string describing the
5953 given error code. If an invalid error code is passed, the string "Unknown
5954 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
5955 <tt/errno/ is left untouched.
5956 <tag/Notes/<itemize>
5957 <item>The function is only available as fastcall function, so it may only
5958 be used in presence of a prototype.
5959 <item>While the return type of the function is a <tt/char*/, the returned
5960 string must not be modified by the caller!
5962 <tag/Availability/ISO 9899
5964 <ref id="_stroserror" name="_stroserror">
5970 <sect1>stricmp<label id="stricmp"><p>
5974 <tag/Function/Compare two strings case insensitive.
5975 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5976 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
5977 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
5978 parameters without case sensitivity. It returns a value that is less than zero
5979 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
5980 value greater than zero if <tt/s1/ is greater than <tt/s2/.
5981 <tag/Notes/<itemize>
5982 <item>The function is only available as fastcall function, so it may only
5983 be used in presence of a prototype.
5984 <item>The function is not available in strict ANSI mode.
5986 <tag/Availability/cc65
5988 <ref id="strcasecmp" name="strcasecmp">,
5989 <ref id="strcmp" name="strcmp">,
5990 <ref id="strcoll" name="strcoll">,
5991 <ref id="strncmp" name="strncmp">,
5992 <ref id="strxfrm" name="strxfrm">
5998 <sect1>strlen<label id="strlen"><p>
6002 <tag/Function/Return the length of a string.
6003 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6004 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6005 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6006 string to which s points, not including the terminating null byte.
6007 <tag/Notes/<itemize>
6008 <item>The function is only available as fastcall function, so it may only
6009 be used in presence of a prototype.
6010 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6011 function does not work correctly for strings with more than 255 characters.
6013 <tag/Availability/ISO 9899
6015 <ref id="strcpy" name="strcpy">
6021 <sect1>strlower<label id="strlower"><p>
6025 <tag/Function/Make a string lower case.
6026 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6027 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6028 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6029 function to each character of a string. The function will always return <tt/s/.
6030 <tag/Notes/<itemize>
6031 <item>The function is only available as fastcall function, so it may only
6032 be used in presence of a prototype.
6033 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6034 <item>An alias name for this function is <tt/strlwr/.
6036 <tag/Availability/cc65
6038 <ref id="strupper" name="strupper">,
6039 <ref id="tolower" name="tolower">
6045 <sect1>strlwr<label id="strlwr"><p>
6052 <sect1>strncat<label id="strncat"><p>
6056 <tag/Function/Concatentate two strings.
6057 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6058 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6059 <tag/Description/The <tt/strncat/ function appends not more than n characters
6060 of the string pointed to by s2 to the end of the string pointed to by s1. The
6061 terminating null character at the end of s1 is overwritten. A terminating null
6062 character is appended to the result, even if not all of s2 is appended to s1.
6063 <tag/Notes/<itemize>
6064 <item>The function is only available as fastcall function, so it may only
6065 be used in presence of a prototype.
6066 <item>If copying takes place between objects that overlap, the behaviour
6069 <tag/Availability/ISO 9899
6071 <ref id="strcpy" name="strcpy">,
6072 <ref id="strncat" name="strncat">,
6073 <ref id="strncpy" name="strncpy">
6079 <sect1>strncmp<label id="strncmp"><p>
6083 <tag/Function/Compare two strings.
6084 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6085 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6086 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6087 characters of the two strings passed as parameters. It returns a value that is
6088 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6089 <tt/s2/, zero if they are identical, and a value greater than zero they are
6091 <tag/Notes/<itemize>
6092 <item>The function is only available as fastcall function, so it may only
6093 be used in presence of a prototype.
6095 <tag/Availability/ISO 9899
6097 <ref id="strcasecmp" name="strcasecmp">,
6098 <ref id="strcmp" name="strcmp">,
6099 <ref id="strcoll" name="strcoll">,
6100 <ref id="stricmp" name="stricmp">,
6101 <ref id="strxfrm" name="strxfrm">
6107 <sect1>strncpy<label id="strncpy"><p>
6111 <tag/Function/Copy part of a string.
6112 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6113 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6114 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6115 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6116 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6117 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6118 written. The function always will return <tt/s1/.
6119 <tag/Notes/<itemize>
6120 <item>The function is available only as a fastcall function; so, it may be used
6121 only in the presence of a prototype.
6122 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6123 to by <tt/s2/, the result is <em/not/ null-terminated!
6124 <item>If copying takes place between objects that overlap, the behaviour is
6127 <tag/Availability/ISO 9899
6129 <ref id="memcpy" name="memcpy">,
6130 <ref id="strcat" name="strcat">,
6131 <ref id="strcpy" name="strcpy">,
6132 <ref id="strncat" name="strncat">
6137 static char hello[6];
6139 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6145 <sect1>strqtok<label id="strqtok"><p>
6149 <tag/Function/Break a string into tokens.
6150 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6151 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6152 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6153 tokens, which are delimited by either quotation marks or characters from the
6154 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6155 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6156 pointer to the first token in the string <tt/s1/. The following calls must pass
6157 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6158 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6159 <tag/Notes/<itemize>
6160 <item>The function is available only as a fastcall function; so, it may be used
6161 only in the presence of a prototype.
6162 <item><tt/strqtok()/ will modify the string <tt/s1/.
6163 <item>The function will forget where it is in the <tt/s1/ string if it is given
6164 a second <tt/s1/ string before it finishes the first one.
6166 <tag/Availability/cc65
6168 <ref id="strcspn" name="strcspn">,
6169 <!-- <ref id="strpbrk" name="strpbrk">, -->
6170 <ref id="strspn" name="strspn">,
6171 <ref id="strtok" name="strtok">
6177 <sect1>strrchr<label id="strrchr"><p>
6181 <tag/Function/Search for a character in a string.
6182 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6183 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6184 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6185 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6186 byte is considered to be part of the string. Upon completion, the function
6187 returns a pointer to the byte, or a null pointer if the byte was not found.
6188 <tag/Notes/<itemize>
6189 <item>The function is only available as fastcall function, so it may only
6190 be used in presence of a prototype.
6192 <tag/Availability/ISO 9899
6194 <ref id="strchr" name="strchr">
6200 <sect1>strspn<label id="strspn"><p>
6204 <tag/Function/Compute the length of a substring.
6205 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6206 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6207 <tag/Description/The <tt/strspn/ function computes and returns the length of
6208 the substring pointed to by <tt/s/ which does consist only of characters
6209 contained in the string <tt/set/.
6210 <tag/Notes/<itemize>
6211 <item>The function is only available as fastcall function, so it may only
6212 be used in presence of a prototype.
6214 <tag/Availability/ISO 9899
6216 <ref id="strcspn" name="strcspn">,
6217 <ref id="strstr" name="strstr">
6223 <sect1>strstr<label id="strstr"><p>
6227 <tag/Function/Find a substring.
6228 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6229 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6230 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6231 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6232 otherwise it returns <tt/NULL/.
6233 <tag/Notes/<itemize>
6234 <item>The function is only available as fastcall function, so it may only
6235 be used in presence of a prototype.
6237 <tag/Availability/ISO 9899
6239 <ref id="strcspn" name="strcspn">,
6240 <ref id="strspn" name="strspn">
6246 <sect1>strtok<label id="strtok"><p>
6250 <tag/Function/Break a string into tokens.
6251 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6252 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6253 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6254 tokens, which are delimited by characters from the string <tt/s2/. The first call
6255 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6256 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6257 the next token in the string. Different sets of delimiters may be used for the
6258 subsequent calls to <tt/strtok()/.
6259 <tag/Notes/<itemize>
6260 <item>The function is only available as fastcall function, so it may only
6261 be used in presence of a prototype.
6262 <item><tt/strtok()/ will modify the string <tt/s1/.
6263 <item>The function will forget where it is in the <tt/s1/ string if it is given
6264 a second <tt/s1/ string before it finishes the first one.
6266 <tag/Availability/ISO 9899
6268 <ref id="strcspn" name="strcspn">,
6269 <!-- <ref id="strpbrk" name="strpbrk">, -->
6270 <ref id="strqtok" name="strqtok">,
6271 <ref id="strspn" name="strspn">
6277 <sect1>strxfrm<label id="strxfrm"><p>
6281 <tag/Function/Transform a string.
6282 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6283 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6284 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6285 s2 and places the resulting string into the string pointed to by s1. The
6286 transformation is such that if the <tt/strcmp/ function is applied to two
6287 transformed strings, it returns a value greater than, equal to, or less than
6288 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6289 same two original strings. No more than n characters are placed into the
6290 resulting array pointed to by s1, including the terminating null character.
6291 <tag/Notes/<itemize>
6292 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6293 the behaviour is undefined.
6294 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6295 <item>The function is only available as fastcall function, so it may only
6296 be used in presence of a prototype.
6297 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6298 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6300 <tag/Availability/ISO 9899
6302 <ref id="strcmp" name="strcmp">,
6303 <ref id="strcoll" name="strcoll">,
6304 <ref id="strncpy" name="strncpy">
6310 <sect1>strupper<label id="strupper"><p>
6314 <tag/Function/Make a string upper case.
6315 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6316 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6317 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6318 function to each character of a string. The function will always return <tt/s/.
6319 <tag/Notes/<itemize>
6320 <item>The function is only available as fastcall function, so it may only
6321 be used in presence of a prototype.
6322 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6323 <item>An alias name for this function is <tt/strupr/.
6325 <tag/Availability/cc65
6327 <ref id="strlower" name="strlower">
6328 <ref id="toupper" name="toupper">
6334 <sect1>strupr<label id="strupr"><p>
6341 <sect1>telldir<label id="telldir"><p>
6345 <tag/Function/Return the current position of a directory stream.
6346 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6347 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6348 <tag/Description/<tt/telldir/ returns the current position of a directory
6349 stream. The return value may be used in subsequent calls to
6350 <tt/<ref id="seekdir" name="seekdir">/.
6351 <tag/Notes/<itemize>
6352 <item>The function is only available as fastcall function, so it may only
6353 be used in presence of a prototype.
6355 <tag/Availability/POSIX 1003.1
6357 <ref id="seekdir" name="seekdir">,
6358 <ref id="telldir" name="telldir">
6364 <sect1>textcolor<label id="textcolor"><p>
6368 <tag/Function/Set the text color.
6369 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6370 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6371 <tag/Description/The function will set a new text color. It returns the old
6372 (current) text color. Text output using any <tt/conio.h/ function will use
6373 the color set by this function.
6374 <tag/Notes/<itemize>
6375 <item>Text colors are system dependent. The function may have no effect
6376 on systems where the text color cannot be changed.
6377 <item>The function is only available as fastcall function, so it may only
6378 be used in presence of a prototype.
6380 <tag/Availability/cc65
6382 <ref id="bgcolor" name="bgcolor">,
6383 <ref id="bordercolor" name="bordercolor">
6389 <sect1>tgi_arc<label id="tgi_arc"><p>
6393 <tag/Function/Draw an elliptic arc in the current color.
6394 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6395 <tag/Declaration/<tt/void __fastcall__ tgi_arc (int x, int y,
6396 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
6397 <tag/Description/The function draws an elliptic arc with center at x/y and
6398 radii rx/ry using the current drawing color. The arc covers the angle
6399 between sa and ea (startangle and endangle), which must be in the range
6401 <tag/Notes/<itemize>
6402 <item>The function is only available as fastcall function, so it may only
6403 be used in presence of a prototype.
6404 <item>The function behaves unexpectedly or may crash if the angles are out
6407 <tag/Availability/cc65
6409 <ref id="tgi_bar" name="tgi_bar">,
6410 <ref id="tgi_circle" name="tgi_circle">,
6411 <ref id="tgi_ellipse" name="tgi_ellipse">,
6412 <ref id="tgi_pieslice" name="tgi_pieslice">,
6413 <ref id="tgi_setcolor" name="tgi_setcolor">
6415 /* Draw the upper half of an ellipse */
6416 tgi_setcolor(TGI_COLOR_BLUE);
6417 tgi_arc (50, 50, 40, 20, 0, 180);
6423 <sect1>tgi_bar<label id="tgi_bar"><p>
6427 <tag/Function/The function fills a rectangle on the drawpage with the current
6429 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6430 <tag/Declaration/<tt/void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);/
6431 <tag/Description/The function fills a rectangle on the drawpage with the current
6433 <tag/Notes/<itemize>
6434 <item>The function is only available as fastcall function, so it may only
6435 be used in presence of a prototype.
6437 <tag/Availability/cc65
6438 <tag/See also/Other tgi function
6440 tgi_setcolor(TGI_COLOR_GREEN);
6441 tgi_bar(10, 10, 100, 60);
6447 <sect1>tgi_circle<label id="tgi_circle"><p>
6451 <tag/Function/The function draws a circle in the current color.
6452 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6453 <tag/Declaration/<tt/void __fastcall__ tgi_circle (int x, int y, unsigned char radius);/
6454 <tag/Description/The function draws a circle in the current color.
6455 <tag/Notes/<itemize>
6456 <item>The function is only available as fastcall function, so it may only
6457 be used in presence of a prototype.
6459 <tag/Availability/cc65
6461 <ref id="tgi_arc" name="tgi_arc">,
6462 <ref id="tgi_bar" name="tgi_bar">,
6463 <ref id="tgi_ellipse" name="tgi_ellipse">,
6464 <ref id="tgi_pieslice" name="tgi_pieslice">,
6465 <ref id="tgi_setcolor" name="tgi_setcolor">
6467 tgi_setcolor(TGI_COLOR_BLACK);
6468 tgi_circle(50, 40, 40);
6474 <sect1>tgi_clear<label id="tgi_clear"><p>
6478 <tag/Function/Clear the drawpage
6479 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6480 <tag/Declaration/<tt/void tgi_clear (void);/
6481 <tag/Description/Clear the drawpage
6482 <tag/Availability/cc65
6483 <tag/See also/Other tgi functions
6489 <sect1>tgi_done<label id="tgi_done"><p>
6493 <tag/Function/End graphics mode, switch back to text mode.
6494 Will NOT uninstall or unload the driver!
6495 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6496 <tag/Declaration/<tt/void tgi_done (void);/
6497 <tag/Description/End graphics mode, switch back to text mode.
6498 Will NOT uninstall or unload the driver!
6499 <tag/Availability/cc65
6500 <tag/See also/Other tgi functions
6506 <sect1>tgi_ellipse<label id="tgi_ellipse"><p>
6510 <tag/Function/The function draws an ellipse in the current color.
6511 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6512 <tag/Declaration/<tt/void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);/
6513 <tag/Description/The function draws an ellipse at position x/y with radii
6514 rx and ry, using the current drawing color.
6515 <tag/Notes/<itemize>
6516 <item>The function is only available as fastcall function, so it may only
6517 be used in presence of a prototype.
6519 <tag/Availability/cc65
6521 <ref id="tgi_arc" name="tgi_arc">,
6522 <ref id="tgi_bar" name="tgi_bar">,
6523 <ref id="tgi_circle" name="tgi_circle">,
6524 <ref id="tgi_pieslice" name="tgi_pieslice">,
6525 <ref id="tgi_setcolor" name="tgi_setcolor">
6527 tgi_setcolor(TGI_COLOR_RED);
6528 tgi_ellipse (50, 40, 40, 20);
6534 <sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p>
6538 <tag/Function/Free a vector font that was previously loaded into memory.
6539 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6540 <tag/Declaration/<tt/void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);/
6541 <tag/Description/Free a vector font that was previously loaded into memory.
6542 <tag/Notes/<itemize>
6543 <item>The function is only available as fastcall function, so it may only
6544 be used in presence of a prototype.
6546 <tag/Availability/cc65
6548 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6549 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
6555 <sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p>
6557 <quote> <descrip> <tag/Function/Return the pixel aspect ratio.
6558 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6559 <tag/Declaration/<tt/unsigned tgi_getaspectratio (void);/
6560 <tag/Description/The function returns the pixel aspect ratio for the current
6561 driver and display as an 8.8 fixed point value. It may be used to correct
6562 geometric shapes so they look correct on the display. As an example, a circle
6563 with a radius of 100 pixels may look elliptic on some driver/display
6564 combinations if the aspect ratio is not 1.00.
6565 <tag/Notes/<itemize>
6566 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
6567 monitor for the given platform. The aspect ratio may be wrong if another
6569 <item>No TGI function will use the aspect ratio. It is up to the programmer to
6571 <item>The <ref id="tgi_setaspectratio" name="tgi_setaspectratio"> function can
6572 be used to change the aspect ratio for a loaded driver. The value is not reset
6573 by <ref id="tgi_init" name="tgi_init">, so if a driver is linked statically to
6574 an application, switching into and out of graphics mode will not restore the
6575 original aspect ratio.
6577 <tag/Availability/cc65
6579 <ref id="tgi_setaspectratio" name="tgi_setaspectratio">
6585 <sect1>tgi_getcolor<label id="tgi_getcolor"><p>
6589 <tag/Function/Return the current drawing color.
6590 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6591 <tag/Declaration/<tt/unsigned char tgi_getcolor (void);/
6592 <tag/Description/The actual color is an index to a palette. During tgi_init
6593 you will get a default palette. The number of colors depend on the platform.
6594 All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some
6595 platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN
6596 and then you change the green of the palette to blue using tgi_setpalette then
6597 after this painting in TGI_COLOR_GREEN will actually be blue.
6598 <tag/Availability/cc65
6599 <tag/See also/Other tgi functions
6601 color = tgi_getcolor();
6607 <sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p>
6611 <tag/Function/Get the number of available colors.
6612 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6613 <tag/Declaration/<tt/unsigned char tgi_getcolorcount (void);/
6614 <tag/Description/Tgi platforms use indexed color palettes. This function
6615 returns the number of entries we can use in the palette.
6616 <tag/Availability/cc65
6617 <tag/See also/Other tgi functions
6619 if (tgi_getcolorcount() == 2) {
6620 printf("Only monochrome graphics is supported\n");
6627 <sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p>
6631 <tag/Function/Get the palette installed by default.
6632 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6633 <tag/Declaration/<tt/const unsigned char* tgi_getdefpalette (void);/
6634 <tag/Description/The tgi driver has a default palette that is active at startup.
6635 The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this
6636 palette to work correctly.
6637 <tag/Availability/cc65
6638 <tag/See also/Other tgi functions
6644 <sect1>tgi_geterror<label id="tgi_geterror"><p>
6648 <tag/Function/Return the error code for the last operation.
6649 This will also clear the error.
6650 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6651 <tag/Declaration/<tt/unsigned char tgi_geterror (void);/
6652 <tag/Description/Return the error code for the last operation.
6653 This will also clear the error.
6654 <tag/Availability/cc65
6655 <tag/See also/Other tgi functions
6661 <sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p>
6665 <tag/Function/Get an error message describing the error.
6666 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6667 <tag/Declaration/<tt/const char* __fastcall__ tgi_geterrormsg (unsigned char code);/
6668 <tag/Description/Get an error message describing the error.
6669 <tag/Notes/<itemize>
6670 <item>The function is only available as fastcall function, so it may only
6671 be used in presence of a prototype.
6673 <tag/Availability/cc65
6674 <tag/See also/Other tgi functions
6680 <sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p>
6684 <tag/Function/Get the highest index of the palette.
6685 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6686 <tag/Declaration/<tt/unsigned char tgi_getmaxcolor (void);/
6687 <tag/Description/Get the highest index of the palette.
6688 <tag/Availability/cc65
6689 <tag/See also/Other tgi functions
6695 <sect1>tgi_getmaxx<label id="tgi_getmaxx"><p>
6699 <tag/Function/Get the maximum x coordinate that can be used on this screen.
6700 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6701 <tag/Declaration/<tt/unsigned tgi_getmaxx (void);/
6702 <tag/Description/Get the maximum x coordinate that can be used on this screen.
6703 <tag/Availability/cc65
6704 <tag/See also/Other tgi functions
6710 <sect1>tgi_getmaxy<label id="tgi_getmaxy"><p>
6714 <tag/Function/Get the maximum y coordinate that can be used on this screen.
6715 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6716 <tag/Declaration/<tt/unsigned tgi_getmaxy (void);/
6717 <tag/Description/Get the maximum y coordinate that can be used on this screen.
6718 <tag/Availability/cc65
6719 <tag/See also/Other tgi functions
6725 <sect1>tgi_getpagecount<label id="tgi_getpagecount"><p>
6729 <tag/Function/Return the number of screen pages available.
6730 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6731 <tag/Declaration/<tt/unsigned tgi_getpagecount (void);/
6732 <tag/Description/Return the number of screen pages available.
6733 <tag/Availability/cc65
6735 <ref id="tgi_setdrawpage" name="tgi_setdrawpage">,
6736 <ref id="tgi_setviewpage" name="tgi_setviewpage">
6742 <sect1>tgi_getpalette<label id="tgi_getpalette"><p>
6746 <tag/Function/Get the palette installed.
6747 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6748 <tag/Declaration/<tt/const unsigned char* tgi_getpalette (void);/
6749 <tag/Description/Get the palette installed.
6750 <tag/Availability/cc65
6751 <tag/See also/Other tgi functions
6757 <sect1>tgi_getpixel<label id="tgi_getpixel"><p>
6761 <tag/Function/Get the color of a pixel from the viewpage.
6762 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6763 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/
6764 <tag/Description/Get the color of a pixel from the viewpage.
6765 <tag/Notes/<itemize>
6766 <item>The function is only available as fastcall function, so it may only
6767 be used in presence of a prototype.
6769 <tag/Availability/cc65
6770 <tag/See also/Other tgi functions.
6776 <sect1>tgi_getxres<label id="tgi_getxres"><p>
6780 <tag/Function/Get number of horisontal pixels on the screen.
6781 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6782 <tag/Declaration/<tt/unsigned tgi_getxres (void);/
6783 <tag/Description/Get number of horisontal pixels on the screen.
6784 This is same as tgi_maxx()+1.
6785 <tag/Availability/cc65
6786 <tag/See also/Other tgi functions.
6792 <sect1>tgi_getyres<label id="tgi_getyres"><p>
6796 <tag/Function/Get number of vertical pixels on the screen.
6797 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6798 <tag/Declaration/<tt/unsigned tgi_getyres (void);/
6799 <tag/Description/Get number of vertical pixels on the screen.
6800 This is same as tgi_maxy()+1.
6801 <tag/Availability/cc65
6802 <tag/See also/Other tgi functions.
6808 <sect1>tgi_gotoxy<label id="tgi_gotoxy"><p>
6812 <tag/Function/Set graphics cursor at x, y.
6813 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6814 <tag/Declaration/<tt/void __fastcall__ tgi_gotoxy (int x, int y);/
6815 <tag/Description/Set graphics cursor at x, y.
6816 <tag/Notes/<itemize>
6817 <item>The function is only available as fastcall function, so it may only
6818 be used in presence of a prototype.
6820 <tag/Availability/cc65
6821 <tag/See also/Other tgi functions.
6827 <sect1>tgi_init<label id="tgi_init"><p>
6831 <tag/Function/Initialize the already loaded graphics driver.
6832 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6833 <tag/Declaration/<tt/void tgi_init (void);/
6834 <tag/Description/The tgi_init function will set the default palette to the
6836 <tag/Notes/<itemize>
6837 <item><tt/tgi_init/ will not clear the screen. This allows switching between
6838 text and graphics mode on platforms that have separate memory areas for the
6839 screens. If you want the screen cleared, call <tt/<ref id="tgi_clear"
6840 name="tgi_clear">/ after <tt/tgi_init/.
6842 <tag/Availability/cc65
6843 <tag/See also/Other tgi functions.
6845 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6846 tgi_init(); //Set up the default palette and clear the screen.
6852 <sect1>tgi_install<label id="tgi_install"><p>
6856 <tag/Function/Install an already loaded driver and return an error code.
6857 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6858 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_install (void* driver);/
6859 <tag/Description/The function installs a driver that was already loaded into
6860 memory (or linked statically to the program). It returns an error code
6861 (<tt/TGI_ERR_OK/ in case of success).
6862 <tag/Notes/<itemize>
6863 <item>The function is only available as fastcall function, so it may only be
6864 used in presence of a prototype.
6866 <tag/Availability/cc65
6868 <ref id="tgi_load_driver" name="tgi_load_driver">,
6869 <ref id="tgi_uninstall" name="tgi_uninstall">,
6870 <ref id="tgi_unload" name="tgi_unload">
6872 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6873 tgi_init(); //Set up the default palette and clear the screen.
6879 <sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p>
6883 <tag/Function/Install an already loaded driver and return an error code.
6884 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6885 <tag/Declaration/<tt/void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);/
6887 Install a vector font for use. More than one vector font can be loaded,
6888 but only one can be active. This function is used to tell which one. Call
6889 with a NULL pointer to uninstall the currently installed font.
6890 <tag/Notes/<itemize>
6891 <item>The function is only available as fastcall function, so it may only be
6892 used in presence of a prototype.
6894 <tag/Availability/cc65
6896 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6897 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
6903 <sect1>tgi_ioctl<label id="tgi_ioctl"><p>
6907 <tag/Function/Platform dependent code extensions.
6908 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6909 <tag/Declaration/<tt/unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);/
6910 <tag/Description/Some platforms have extra display hardware that is not
6911 supported by standard tgi functions. You can extend the driver to support
6912 this extra hardware using tgi_ioctl functions.
6913 <tag/Notes/<itemize>
6914 <item>The function is only available as fastcall function, so it may only
6915 be used in presence of a prototype.
6916 <item>These functions are not easily portable to other cc65 platforms.
6918 <tag/Availability/cc65
6919 <tag/See also/Other tgi functions.
6921 #define tgi_sprite(spr) tgi_ioctl(0, (void*)(spr))
6922 #define tgi_flip() tgi_ioctl(1, (void*)0)
6923 #define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
6924 #define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
6925 #define tgi_busy() tgi_ioctl(4, (void*)0)
6926 #define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
6928 tgi_sprite(&background);
6929 tgi_setcolor(TGI_COLOR_BLUE);
6930 tgi_outttextxy(20,40,"Hello World");
6931 tgi_updatedisplay();
6938 <sect1>tgi_line<label id="tgi_line"><p>
6942 <tag/Function/Draw a line in the current drawing color.
6943 The graphics cursor will be set to x2/y2 by this call.
6944 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6945 <tag/Declaration/<tt/void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);/
6946 <tag/Description/Draw a line in the current drawing color.
6947 The graphics cursor will be set to x2/y2 by this call.
6948 <tag/Notes/<itemize>
6949 <item>The function is only available as fastcall function, so it may only
6950 be used in presence of a prototype.
6952 <tag/Availability/cc65
6953 <tag/See also/Other tgi functions.
6959 <sect1>tgi_lineto<label id="tgi_lineto"><p>
6963 <tag/Function/Draw a line in the current drawing color from the graphics
6964 cursor to the new end point. The graphics cursor will be updated to x2/y2.
6965 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6966 <tag/Declaration/<tt/void __fastcall__ tgi_lineto (int x2, int y2);/
6967 <tag/Description/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/Notes/<itemize>
6970 <item>The function is only available as fastcall function, so it may only
6971 be used in presence of a prototype.
6973 <tag/Availability/cc65
6974 <tag/See also/Other tgi functions.
6980 <sect1>tgi_load_driver<label id="tgi_load_driver"><p>
6984 <tag/Function/Load and install the given driver.
6985 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6986 <tag/Declaration/<tt/void __fastcall__ tgi_load_driver (const char *name);/
6987 <tag/Description/Load and install the driver by name.
6988 Will just load the driver and check if loading was successful.
6989 Will not switch to graphics mode.
6990 <tag/Notes/<itemize>
6991 <item>The function is only available as fastcall function, so it may only
6992 be used in presence of a prototype.
6994 <tag/Availability/cc65
6995 <tag/See also/Other tgi functions.
7001 <sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p>
7005 <tag/Function/Load the given vector font.
7006 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7007 <tag/Declaration/<tt/const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);/
7009 Load a vector font into memory and return it. In case of errors, NULL is
7010 returned and an error is set, which can be retrieved using tgi_geterror.
7011 To use the font, it has to be installed using tgi_install_vectorfont.
7012 <tag/Notes/<itemize>
7013 <item>The function is only available as fastcall function, so it may only
7014 be used in presence of a prototype.
7016 <tag/Availability/cc65
7018 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">,
7019 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
7025 <sect1>tgi_outtext<label id="tgi_outtext"><p>
7029 <tag/Function/Output text at the current graphics cursor position.
7030 The graphics cursor is moved to the end of the text.
7031 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7032 <tag/Declaration/<tt/void __fastcall__ tgi_outtext (const char* s);/
7033 <tag/Description/Output text at the current graphics cursor position.
7034 The graphics cursor is moved to the end of the text.
7035 <tag/Notes/<itemize>
7036 <item>The function is only available as fastcall function, so it may only
7037 be used in presence of a prototype.
7039 <tag/Availability/cc65
7040 <tag/See also/Other tgi functions.
7046 <sect1>tgi_outtextxy<label id="tgi_outtextxy"><p>
7050 <tag/Function/Output text at the given cursor position.
7051 The graphics cursor is moved to the end of the text.
7052 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7053 <tag/Declaration/<tt/void __fastcall__ tgi_outtextxy (int x, int y, const char* s);/
7054 <tag/Description/Output text at the given cursor position.
7055 The graphics cursor is moved to the end of the text.
7056 <tag/Notes/<itemize>
7057 <item>The function is only available as fastcall function, so it may only
7058 be used in presence of a prototype.
7060 <tag/Availability/cc65
7061 <tag/See also/Other tgi functions.
7067 <sect1>tgi_pieslice<label id="tgi_pieslice"><p>
7071 <tag/Function/Draw an elliptic pie slice in the current color.
7072 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7073 <tag/Declaration/<tt/void __fastcall__ tgi_pie slice (int x, int y,
7074 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
7075 <tag/Description/The function draws an elliptic pie slice with center at x/y
7076 and radii rx/ry using the current drawing color. The pie slice covers the angle
7077 between sa and ea (startangle and endangle), which must be in the range
7079 <tag/Notes/<itemize>
7080 <item>The function is only available as fastcall function, so it may only
7081 be used in presence of a prototype.
7082 <item>The function behaves unexpectedly or may crash if the angles are out
7085 <tag/Availability/cc65
7087 <ref id="tgi_bar" name="tgi_arc">,
7088 <ref id="tgi_bar" name="tgi_bar">,
7089 <ref id="tgi_circle" name="tgi_circle">,
7090 <ref id="tgi_ellipse" name="tgi_ellipse">,
7091 <ref id="tgi_setcolor" name="tgi_setcolor">
7093 /* Draw the closed upper half of an ellipse */
7094 tgi_setcolor(TGI_COLOR_BLUE);
7095 tgi_pieslice (50, 50, 40, 20, 0, 180);
7101 <sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p>
7103 <quote> <descrip> <tag/Function/Set the pixel aspect ratio.
7104 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7105 <tag/Declaration/<tt/void __fastcall__ tgi_setaspectratio (unsigned ratio);/
7106 <tag/Description/The function sets the pixel aspect ratio for the current
7107 driver and display. The argument is an 8.8 fixed point value. The aspect ratio
7108 may be used to correct geometric shapes so they look correct on a given
7109 display. As an example, a circle with a radius of 100 pixels may look elliptic
7110 on some driver/display combinations if the aspect ratio is not 1.00.
7111 <tag/Notes/<itemize>
7112 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
7113 monitor for the given platform. The aspect ratio may be wrong if another
7115 <item>No TGI function will use the aspect ratio. It is up to the programmer to
7117 <item>The <tt/tgi_setaspectratio/ function can be used to change the aspect
7118 ratio for a loaded driver. The value is not reset by <ref id="tgi_init"
7119 name="tgi_init">, so if a driver is linked statically to an application,
7120 switching into and out of graphics mode will not restore the original aspect
7122 <item>The function is available only as a fastcall function; so, it may be used
7123 only in the presence of a prototype.
7125 <tag/Availability/cc65
7127 <ref id="tgi_getaspectratio" name="tgi_getaspectratio">
7133 <sect1>tgi_setcolor<label id="tgi_setcolor"><p>
7137 <tag/Function/Set color to be used in future draw operations.
7138 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7139 <tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/
7140 <tag/Description/Set color to be used in future draw operations.
7141 <tag/Notes/<itemize>
7142 <item>The function is only available as fastcall function, so it may only
7143 be used in presence of a prototype.
7145 <tag/Availability/cc65
7146 <tag/See also/Other tgi functions.
7148 tgi_setcolor(TGI_COLOR_BLACK);
7150 tgi_setcolor(TGI_COLOR_WHITE);
7151 tgi_bar(10,10,20,20);
7156 <sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p>
7160 <tag/Function/Set the page for drawing.
7161 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7162 <tag/Declaration/<tt/void __fastcall__ tgi_setdrawpage (unsigned char page);/
7163 <tag/Description/If the drawpage and the viewpage are the same then all drawing
7164 is seen immediately as it is drawn. For double buffered games you can set the
7165 drawpage to a different page than the viewpage. This lets you draw the next
7166 screen in the background and when the screen is ready you display it.
7167 <tag/Notes/<itemize>
7168 <item>The function is only available as fastcall function, so it may only
7169 be used in presence of a prototype.
7171 <tag/Availability/cc65
7172 <tag/See also/Other tgi functions.
7175 tgi_outtextxy(10, 10, "Hello World");
7176 tgi_setviewpage(1); // Show page 1
7178 tgi_outtextxy(10, 10, "Creating next frame");
7180 tgi_setviewpage(0); // Show page 0
7185 <sect1>tgi_setpalette<label id="tgi_setpalette"><p>
7189 <tag/Function/Set the palette (not available with all drivers/hardware).
7190 Palette is a pointer to as many entries as there are colors.
7191 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7192 <tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/
7193 <tag/Description/Set the palette (not available with all drivers/hardware).
7194 Palette is a pointer to as many entries as there are colors.
7195 <tag/Notes/<itemize>
7196 <item>The function is only available as fastcall function, so it may only
7197 be used in presence of a prototype.
7199 <tag/Availability/cc65
7200 <tag/See also/Other tgi functions.
7205 <sect1>tgi_setpixel<label id="tgi_setpixel"><p>
7209 <tag/Function/Plot a pixel on the drawpage with the current color.
7210 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7211 <tag/Declaration/<tt/void __fastcall__ tgi_setpixel (int x, int y);/
7212 <tag/Description/Plot a pixel on the drawpage with the current color.
7213 <tag/Notes/<itemize>
7214 <item>The function is only available as fastcall function, so it may only
7215 be used in presence of a prototype.
7217 <tag/Availability/cc65
7218 <tag/See also/Other tgi functions.
7223 <sect1>tgi_setviewpage<label id="tgi_setviewpage"><p>
7227 <tag/Function/Set page to be visible on screen.
7228 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7229 <tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/
7230 <tag/Description/If the drawpage and the viewpage are the same then all drawing
7231 is seen immediately as it is drawn. For double buffered games you can set the
7232 drawpage to a different page than the viewpage. This lets you draw the next
7233 screen in the background and when the screen is ready you display it.
7234 <tag/Notes/<itemize>
7235 <item>The function is only available as fastcall function, so it may only
7236 be used in presence of a prototype.
7238 <tag/Availability/cc65
7239 <tag/See also/Other tgi functions.
7242 tgi_outtextxy(10, 10, "Hello World");
7243 tgi_setviewpage(1); // Show page 1
7245 tgi_outtextxy(10, 10, "Creating next frame");
7247 tgi_setviewpage(0); // Show page 0
7252 <sect1>tgi_gettextheight<label id="tgi_gettextheight"><p>
7256 <tag/Function/Calculate the height of the text in pixels according to
7257 the current text style.
7258 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7259 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/
7260 <tag/Description/Calculate the height of the text in pixels according to
7261 the current text style.
7262 <tag/Notes/<itemize>
7263 <item>The function is only available as fastcall function, so it may only
7264 be used in presence of a prototype.
7266 <tag/Availability/cc65
7267 <tag/See also/Other tgi functions.
7272 <sect1>tgi_settextscale<label id="tgi_settextscale"><p>
7276 <tag/Function/Set the scaling for text output.
7277 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7278 <tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/
7280 Set the scaling for text output. The scaling factors for width and height
7281 are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
7282 <tag/Notes/<itemize>
7283 <item>The function is only available as fastcall function, so it may only
7284 be used in presence of a prototype.
7286 <tag/Availability/cc65
7288 <ref id="tgi_settextstyle" name="tgi_settextstyle">
7293 <sect1>tgi_settextstyle<label id="tgi_settextstyle"><p>
7297 <tag/Function/Set the style for text output.
7298 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7299 <tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/
7300 <tag/Description/Set the style for text output.
7301 <tag/Notes/<itemize>
7302 <item>The function is only available as fastcall function, so it may only
7303 be used in presence of a prototype.
7305 <tag/Availability/cc65
7307 <ref id="tgi_settextscale" name="tgi_settextscale">
7312 <sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p>
7316 <tag/Function/Calculate the width of the text in pixels according to the current text style.
7317 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7318 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/
7319 <tag/Description/Calculate the width of the text in pixels according to the current text style.
7320 <tag/Notes/<itemize>
7321 <item>The function is only available as fastcall function, so it may only
7322 be used in presence of a prototype.
7324 <tag/Availability/cc65
7325 <tag/See also/Other tgi functions.
7330 <sect1>tgi_uninstall<label id="tgi_uninstall"><p>
7334 <tag/Function/Uninstall the currently loaded driver but do not unload it.
7335 Will call tgi_done if necessary.
7336 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7337 <tag/Declaration/<tt/void tgi_uninstall (void);/
7338 <tag/Description/Uninstall the currently loaded driver but do not unload it.
7339 Will call tgi_done if necessary.
7340 <tag/Availability/cc65
7341 <tag/See also/Other tgi functions.
7346 <sect1>tgi_unload<label id="tgi_unload"><p>
7350 <tag/Function/Uninstall, then unload the currently loaded driver.
7351 Will call tgi_done if necessary.
7352 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7353 <tag/Declaration/<tt/void tgi_unload (void);/
7354 <tag/Description/Uninstall, then unload the currently loaded driver.
7355 Will call tgi_done if necessary.
7356 <tag/Availability/cc65
7357 <tag/See also/Other tgi functions.
7362 <sect1>time<label id="time"><p>
7366 <tag/Function/Get the time.
7367 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7368 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7369 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7370 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7371 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7372 returned and <tt/errno/ is set to <tt/ENOSYS/.
7373 <tag/Notes/<itemize>
7374 <item>The function is only available as fastcall function, so it may
7375 only be used in presence of a prototype.
7376 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7377 returned value may not be valid.
7379 <tag/Availability/ISO 9899
7381 <ref id="clock" name="clock">
7387 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7391 <tag/Function/Toggle between 40 and 80 column mode.
7392 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7393 <tag/Declaration/<tt/void toggle_videomode (void);/
7394 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7395 old mode (cursor position, color and so on) are saved and restored together
7397 <tag/Notes/<itemize>
7398 <item>The function is specific to the C128.
7399 <item>This function is deprecated. Please use <ref id="videomode"
7400 name="videomode"> instead!
7402 <tag/Availability/C128
7404 <ref id="fast" name="fast">,
7405 <ref id="slow" name="slow">,
7406 <ref id="videomode" name="videomode">
7412 <sect1>tolower<label id="tolower"><p>
7416 <tag/Function/Convert a character into its lower case representation.
7417 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7418 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7419 <tag/Description/The function returns the given character converted to lower
7420 case. If the given character is not a letter, it is returned unchanged.
7421 <tag/Notes/<itemize>
7422 <item>The function is only available as fastcall function, so it may
7423 only be used in presence of a prototype.
7425 <tag/Availability/ISO 9899
7427 <ref id="islower" name="islower">,
7428 <ref id="isupper" name="isupper">,
7429 <ref id="toupper" name="toupper">
7435 <sect1>toupper<label id="toupper"><p>
7439 <tag/Function/Convert a character into its upper case representation.
7440 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7441 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7442 <tag/Description/The function returns the given character converted to upper
7443 case. If the given character is not a letter, it is returned unchanged.
7444 <tag/Notes/<itemize>
7445 <item>The function is only available as fastcall function, so it may
7446 only be used in presence of a prototype.
7448 <tag/Availability/ISO 9899
7450 <ref id="islower" name="islower">,
7451 <ref id="isupper" name="isupper">,
7452 <ref id="tolower" name="tolower">
7458 <sect1>ultoa<label id="ultoa"><p>
7462 <tag/Function/Convert an unsigned long integer into a string.
7463 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7464 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7465 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7466 string using <tt/radix/ as the base.
7467 <tag/Notes/<itemize>
7468 <item>There are no provisions to prevent a buffer overflow.
7469 <item>The function is non standard, so it is not available in strict ANSI mode.
7470 You should probably use <tt/sprintf/ instead.
7471 <item>The function is only available as fastcall function, so it may only be
7472 used in presence of a prototype.
7474 <tag/Availability/cc65
7476 <ref id="atoi" name="atoi">,
7477 <ref id="atol" name="atol">,
7478 <ref id="itoa" name="itoa">,
7479 <ref id="ltoa" name="ltoa">,
7480 <ref id="utoa" name="utoa">
7486 <sect1>unlink<label id="unlink"><p>
7490 <tag/Function/Delete a file.
7491 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7492 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7493 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7494 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7495 code describing the reason for the failure.
7496 <tag/Notes/<itemize>
7497 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7498 name="remove">/ instead, which is a native ANSI C function and does the same.
7499 <item>This function is not available on all cc65 targets (depends on the
7500 availability of file I/O).
7501 <item>The function is only available as fastcall function, so it may only
7502 be used in presence of a prototype.
7503 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7504 used, which has the same semantics, but is more portable, because it conforms
7505 to the ISO C standard.
7507 <tag/Availability/POSIX 1003.1
7509 <ref id="remove" name="remove">
7512 #include <stdio.h>
7513 #include <unistd.h>
7515 #define FILENAME "helloworld"
7517 if (unlink (FILENAME) == 0) {
7518 printf ("We deleted %s successfully\n", FILENAME);
7520 printf ("There was a problem deleting %s\n", FILENAME);
7527 <sect1>utoa<label id="utoa"><p>
7531 <tag/Function/Convert an unsigned integer into a string.
7532 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7533 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7534 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7535 using <tt/radix/ as the base.
7536 <tag/Notes/<itemize>
7537 <item>There are no provisions to prevent a buffer overflow.
7538 <item>The function is non standard, so it is not available in strict ANSI mode.
7539 You should probably use <tt/sprintf/ instead.
7540 <item>The function is only available as fastcall function, so it may only be
7541 used in presence of a prototype.
7543 <tag/Availability/cc65
7545 <ref id="atoi" name="atoi">,
7546 <ref id="atol" name="atol">,
7547 <ref id="itoa" name="itoa">,
7548 <ref id="ltoa" name="ltoa">,
7549 <ref id="ultoa" name="ultoa">
7555 <sect1>vcprintf<label id="vcprintf"><p>
7559 <tag/Function/Formatted output to the console.
7560 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7561 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7562 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7563 text where necessary and formatted according to the format string given. The
7564 resulting string is output to the console. <tt/vcprintf/ supports the same
7565 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7566 <tag/Notes/<itemize>
7567 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7568 between <tt/\r/ and <tt/\n/.
7569 <item>The function is only available as fastcall function, so it may only be
7570 used in presence of a prototype.
7572 <tag/Availability/cc65
7574 <ref id="cprintf" name="cprintf">,
7575 <ref id="cputc" name="cputc">,
7576 <ref id="cputcxy" name="cputcxy">,
7577 <ref id="cputs" name="cputs">,
7578 <ref id="cputsxy" name="cputsxy">
7584 <sect1>videomode<label id="videomode"><p>
7588 <tag/Function/Switch to either 40 or 80 column mode.
7589 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7590 <ref id="c128.h" name="c128.h">/
7591 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7592 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7593 the requested mode is already active, nothing happens. The old mode is returned
7595 <tag/Notes/<itemize>
7596 <item>The function is specific to the C128 and enhanced Apple //e.
7597 <item>This function replaces <ref id="toggle_videomode"
7598 name="toggle_videomode">.
7599 <item>The function is only available as fastcall function, so it may only be
7600 used in presence of a prototype.
7602 <tag/Availability/C128 and enhanced Apple //e
7604 <ref id="fast" name="fast">,
7605 <ref id="slow" name="slow">,
7606 <ref id="toggle_videomode" name="toggle_videomode">
7612 <sect1>wherex<label id="wherex"><p>
7616 <tag/Function/Return the current X position of the text mode cursor.
7617 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7618 <tag/Declaration/<tt/unsigned char wherex (void);/
7619 <tag/Description/The function returns the current X position of the text mode
7620 cursor. Zero is returned for the leftmost screen position.
7621 <tag/Availability/cc65
7623 <ref id="gotox" name="gotox">,
7624 <ref id="gotoy" name="gotoy">,
7625 <ref id="gotoxy" name="gotoxy">,
7626 <ref id="wherey" name="wherey">
7632 <sect1>wherey<label id="wherey"><p>
7636 <tag/Function/Return the current Y position of the text mode cursor.
7637 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7638 <tag/Declaration/<tt/unsigned char wherey (void);/
7639 <tag/Description/The function returns the current Y position of the text mode
7640 cursor. Zero is returned for the uppermost screen position.
7641 <tag/Availability/cc65
7643 <ref id="gotox" name="gotox">,
7644 <ref id="gotoy" name="gotoy">,
7645 <ref id="gotoxy" name="gotoxy">,
7646 <ref id="wherex" name="wherex">