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">
187 <item><ref id="kbrepeatdelay" name="kbrepeatdelay">
188 <item><ref id="kbrepeatrate" name="kbrepeatrate">
194 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
197 <item><ref id="peekbsys" name="peekbsys">
198 <item><ref id="peekwsys" name="peekwsys">
199 <item><ref id="pokebsys" name="pokebsys">
200 <item><ref id="pokewsys" name="pokewsys">
204 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
207 <item><ref id="peekbsys" name="peekbsys">
208 <item><ref id="peekwsys" name="peekwsys">
209 <item><ref id="pokebsys" name="pokebsys">
210 <item><ref id="pokewsys" name="pokewsys">
214 <sect1><tt/cc65.h/<label id="cc65.h"><p>
217 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
218 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
219 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
220 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
221 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
222 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
223 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
224 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
225 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
226 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
232 <sect1><tt/conio.h/<label id="conio.h"><p>
235 <item><ref id="bgcolor" name="bgcolor">
236 <item><ref id="bordercolor" name="bordercolor">
237 <item><ref id="cclear" name="cclear">
238 <item><ref id="cclearxy" name="cclearxy">
239 <item><ref id="cgetc" name="cgetc">
240 <item><ref id="chline" name="chline">
241 <item><ref id="chlinexy" name="chlinexy">
242 <item><ref id="clrscr" name="clrscr">
243 <item><ref id="cprintf" name="cprintf">
244 <item><ref id="cputc" name="cputc">
245 <item><ref id="cputcxy" name="cputcxy">
246 <item><ref id="cputs" name="cputs">
247 <item><ref id="cputsxy" name="cputsxy">
248 <item><ref id="cursor" name="cursor">
249 <item><ref id="cvline" name="cvline">
250 <item><ref id="cvlinexy" name="cvlinexy">
251 <item><ref id="gotox" name="gotox">
252 <item><ref id="gotoxy" name="gotoxy">
253 <item><ref id="gotoy" name="gotoy">
254 <item><ref id="kbhit" name="kbhit">
255 <item><ref id="revers" name="revers">
256 <item><ref id="screensize" name="screensize">
257 <item><ref id="textcolor" name="textcolor">
258 <item><ref id="vcprintf" name="vcprintf">
259 <item><ref id="wherex" name="wherex">
260 <item><ref id="wherey" name="wherey">
264 <sect1><tt/ctype.h/<label id="ctype.h"><p>
267 <item><ref id="isalnum" name="isalnum">
268 <item><ref id="isalpha" name="isalpha">
269 <item><ref id="isascii" name="isascii">
270 <item><ref id="isblank" name="isblank">
271 <item><ref id="iscntrl" name="iscntrl">
272 <item><ref id="isdigit" name="isdigit">
273 <item><ref id="isgraph" name="isgraph">
274 <item><ref id="islower" name="islower">
275 <item><ref id="isprint" name="isprint">
276 <item><ref id="ispunct" name="ispunct">
277 <item><ref id="isspace" name="isspace">
278 <item><ref id="isupper" name="isupper">
279 <item><ref id="isxdigit" name="isxdigit">
280 <item><ref id="tolower" name="tolower">
281 <item><ref id="toupper" name="toupper">
285 <sect1><tt/dbg.h/<label id="dbg.h"><p>
288 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
294 <sect1><tt/dio.h/<label id="dio.h"><p>
296 <url url="dio.html" name="Low-level disk I/O API">.
299 <sect1><tt/dirent.h/<label id="dirent.h"><p>
302 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
303 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
304 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
305 <item><ref id="_DE_ISREG" name="_DE_ISREG">
306 <item><ref id="closedir" name="closedir">
307 <item><ref id="opendir" name="opendir">
308 <item><ref id="readdir" name="readdir">
309 <item><ref id="rewinddir" name="rewinddir">
310 <item><ref id="seekdir" name="seekdir">
311 <item><ref id="telldir" name="telldir">
317 <sect1><tt/em.h/<label id="em.h"><p>
320 <item><ref id="em_commit" name="em_commit">
321 <item><ref id="em_copyfrom" name="em_copyfrom">
322 <item><ref id="em_copyto" name="em_copyto">
323 <item><ref id="em_install" name="em_install">
324 <item><ref id="em_load_driver" name="em_load_driver">
325 <item><ref id="em_map" name="em_map">
326 <item><ref id="em_pagecount" name="em_pagecount">
327 <item><ref id="em_uninstall" name="em_uninstall">
328 <item><ref id="em_unload" name="em_unload">
329 <item><ref id="em_use" name="em_use">
333 <sect1><tt/errno.h/<label id="errno.h"><p>
336 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
337 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
338 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
339 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
345 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
348 <item><ref id="close" name="close">
349 <item><ref id="creat" name="creat">
350 <item><ref id="open" name="open">
354 <sect1><tt/gamate.h/<label id="gamate.h"><p>
357 <!-- <item><ref id="get_tv" name="get_tv"> -->
358 <!-- <item><ref id="waitvblank" name="waitvblank"> -->
364 <sect1><tt/geos.h/<label id="geos.h"><p>
369 <sect1><tt/joystick.h/<label id="joystick.h"><p>
372 <item><ref id="joy_count" name="joy_count">
373 <item><ref id="joy_install" name="joy_install">
374 <item><ref id="joy_load_driver" name="joy_load_driver">
375 <item><ref id="joy_read" name="joy_read">
376 <item><ref id="joy_uninstall" name="joy_uninstall">
377 <item><ref id="joy_unload" name="joy_unload">
381 <sect1><tt/locale.h/<label id="locale.h"><p>
384 <item><ref id="localeconv" name="localeconv">
385 <item><ref id="setlocale" name="setlocale">
389 <sect1><tt/lynx.h/<label id="lynx.h"><p>
392 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
393 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
394 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
395 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
396 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
397 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
398 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
404 <sect1><tt/lz4.h/<label id="lz4.h"><p>
407 <item><ref id="decompress_lz4" name="decompress_lz4">
411 <sect1><tt/modload.h/<label id="modload.h"><p>
414 <item><ref id="mod_load" name="mod_load">
415 <item><ref id="mod_free" name="mod_free">
419 <sect1><tt/mouse.h/<label id="mouse.h"><p>
422 <item><ref id="mouse_buttons" name="mouse_buttons">
423 <item><ref id="mouse_getbox" name="mouse_getbox">
424 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
425 <item><ref id="mouse_hide" name="mouse_hide">
426 <item><ref id="mouse_info" name="mouse_info">
427 <item><ref id="mouse_install" name="mouse_install">
428 <item><ref id="mouse_ioctl" name="mouse_ioctl">
429 <item><ref id="mouse_load_driver" name="mouse_load_driver">
430 <item><ref id="mouse_move" name="mouse_move">
431 <item><ref id="mouse_pos" name="mouse_pos">
432 <item><ref id="mouse_setbox" name="mouse_setbox">
433 <item><ref id="mouse_show" name="mouse_show">
434 <item><ref id="mouse_uninstall" name="mouse_uninstall">
435 <item><ref id="mouse_unload" name="mouse_unload">
439 <sect1><tt/nes.h/<label id="nes.h"><p>
442 <!-- <item><ref id="get_tv" name="get_tv"> -->
443 <!-- <item><ref id="waitvsync" name="waitvsync"> -->
449 <sect1><tt/o65.h/<label id="o65.h"><p>
451 The <tt/o65.h/ header file contains structure and constant definitions that
452 may be used when dealing with files in <url
453 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
454 It does not declare any functions.
457 <sect1><tt/pce.h/<label id="pce.h"><p>
460 <!-- <item><ref id="get_tv" name="get_tv"> -->
461 <!-- <item><ref id="waitvblank" name="waitvblank"> -->
467 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
470 <item><ref id="PEEK" name="PEEK">
471 <item><ref id="PEEKW" name="PEEKW">
472 <item><ref id="POKE" name="POKE">
473 <item><ref id="POKEW" name="POKEW">
477 <sect1><tt/pen.h/<label id="pen.h"><p>
480 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
481 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
487 <sect1><tt/pet.h/<label id="pet.h"><p>
492 <sect1><tt/plus4.h/<label id="plus4.h"><p>
497 <sect1><tt/serial.h/<label id="serial.h"><p>
499 The <tt/serial.h/ header file contains definitions for initializing serial
503 <item><ref id="ser_close" name="ser_close">
504 <item><ref id="ser_get" name="ser_get">
505 <item><ref id="ser_install" name="ser_install">
506 <item><ref id="ser_ioctl" name="ser_ioctl">
507 <item><ref id="ser_load_driver" name="ser_load_driver">
508 <item><ref id="ser_open" name="ser_open">
509 <item><ref id="ser_put" name="ser_put">
510 <item><ref id="ser_status" name="ser_status">
511 <item><ref id="ser_uninstall" name="ser_uninstall">
512 <item><ref id="ser_unload" name="ser_unload">
516 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
519 <item><ref id="setjmp" name="setjmp">
520 <item><ref id="longjmp" name="longjmp">
524 <sect1><tt/signal.h/<label id="signal.h"><p>
527 <item><ref id="raise" name="raise">
528 <item><ref id="signal" name="signal">
532 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
537 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
542 <sect1><tt/stddef.h/<label id="stddef.h"><p>
545 <item><ref id="offsetof" name="offsetof">
549 <sect1><tt/stdio.h/<label id="stdio.h"><p>
552 <item><ref id="_poserror" name="_poserror">
553 <item><ref id="clearerr" name="clearerr">
554 <!-- <item><ref id="fclose" name="fclose"> -->
555 <!-- <item><ref id="fdopen" name="fdopen"> -->
556 <item><ref id="feof" name="feof">
557 <item><ref id="ferror" name="ferror">
558 <!-- <item><ref id="fflush" name="fflush"> -->
559 <!-- <item><ref id="fgetc" name="fgetc"> -->
560 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
561 <!-- <item><ref id="fgets" name="fgets"> -->
562 <item><ref id="fileno" name="fileno">
563 <!-- <item><ref id="fopen" name="fopen"> -->
564 <!-- <item><ref id="fprintf" name="fprintf"> -->
565 <!-- <item><ref id="fputc" name="fputc"> -->
566 <!-- <item><ref id="fputs" name="fputs"> -->
567 <!-- <item><ref id="fread" name="fread"> -->
568 <!-- <item><ref id="freopen" name="freopen"> -->
569 <!-- <item><ref id="fscanf" name="fscanf"> -->
570 <!-- <item><ref id="fseek" name="fseek"> -->
571 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
572 <!-- <item><ref id="ftell" name="ftell"> -->
573 <!-- <item><ref id="fwrite" name="fwrite"> -->
574 <!-- <item><ref id="getc" name="getc"> -->
575 <!-- <item><ref id="getchar" name="getchar"> -->
576 <!-- <item><ref id="gets" name="gets"> -->
577 <!-- <item><ref id="printf" name="printf"> -->
578 <!-- <item><ref id="putc" name="putc"> -->
579 <!-- <item><ref id="putchar" name="putchar"> -->
580 <!-- <item><ref id="puts" name="puts"> -->
581 <item><ref id="rename" name="rename">
582 <item><ref id="remove" name="remove">
583 <!-- <item><ref id="rewind" name="rewind"> -->
584 <!-- <item><ref id="scanf" name="scanf"> -->
585 <!-- <item><ref id="snprintf" name="snprintf"> -->
586 <!-- <item><ref id="sprintf" name="sprintf"> -->
587 <!-- <item><ref id="sscanf" name="sscanf"> -->
588 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
589 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
590 <!-- <item><ref id="vprintf" name="vprintf"> -->
591 <!-- <item><ref id="vscanf" name="vscanf"> -->
592 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
593 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
594 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
600 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
603 <item><ref id="_heapadd" name="_heapadd">
604 <item><ref id="_heapblocksize" name="_heapblocksize">
605 <item><ref id="_heapmaxavail" name="_heapmaxavail">
606 <item><ref id="_heapmemavail" name="_heapmemavail">
607 <item><ref id="_randomize" name="_randomize">
608 <item><ref id="_swap" name="_swap">
609 <item><ref id="abort" name="abort">
610 <item><ref id="abs" name="abs">
611 <item><ref id="atexit" name="atexit">
612 <item><ref id="atoi" name="atoi">
613 <item><ref id="atol" name="atol">
614 <item><ref id="bsearch" name="bsearch">
615 <item><ref id="calloc" name="calloc">
616 <item><ref id="div" name="div">
617 <item><ref id="exit" name="exit">
618 <item><ref id="free" name="free">
619 <item><ref id="getenv" name="getenv">
620 <item><ref id="itoa" name="itoa">
621 <item><ref id="labs" name="labs">
622 <item><ref id="ltoa" name="ltoa">
623 <item><ref id="malloc" name="malloc">
624 <item><ref id="perror" name="perror">
625 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
626 <!-- <item><ref id="putenv" name="putenv"> -->
627 <item><ref id="qsort" name="qsort">
628 <item><ref id="rand" name="rand">
629 <item><ref id="realloc" name="realloc">
630 <item><ref id="srand" name="srand">
631 <!-- <item><ref id="system" name="system"> -->
632 <item><ref id="ultoa" name="ultoa">
633 <item><ref id="utoa" name="utoa">
639 <sect1><tt/string.h/<label id="string.h"><p>
642 <item><ref id="_stroserror" name="_stroserror">
643 <item><ref id="bzero" name="bzero">
644 <item><ref id="memchr" name="memchr">
645 <item><ref id="memcmp" name="memcmp">
646 <item><ref id="memcpy" name="memcpy">
647 <item><ref id="memmove" name="memmove">
648 <item><ref id="memset" name="memset">
649 <item><ref id="strcasecmp" name="strcasecmp">
650 <item><ref id="strcat" name="strcat">
651 <item><ref id="strchr" name="strchr">
652 <item><ref id="strcmp" name="strcmp">
653 <item><ref id="strcoll" name="strcoll">
654 <item><ref id="strcpy" name="strcpy">
655 <item><ref id="strcspn" name="strcspn">
656 <item><ref id="strdup" name="strdup">
657 <item><ref id="strerror" name="strerror">
658 <item><ref id="stricmp" name="stricmp">
659 <item><ref id="strlen" name="strlen">
660 <item><ref id="strlower" name="strlower">
661 <item><ref id="strlwr" name="strlwr">
662 <item><ref id="strncat" name="strncat">
663 <item><ref id="strncmp" name="strncmp">
664 <item><ref id="strncpy" name="strncpy">
665 <item><ref id="strqtok" name="strqtok">
666 <item><ref id="strrchr" name="strrchr">
667 <item><ref id="strspn" name="strspn">
668 <item><ref id="strstr" name="strstr">
669 <item><ref id="strtok" name="strtok">
670 <item><ref id="strxfrm" name="strxfrm">
671 <item><ref id="strupper" name="strupper">
672 <item><ref id="strupr" name="strupr">
678 <sect1><tt/tgi.h/<label id="tgi.h"><p>
681 <item><ref id="tgi_arc" name="tgi_arc">
682 <item><ref id="tgi_bar" name="tgi_bar">
683 <item><ref id="tgi_circle" name="tgi_circle">
684 <item><ref id="tgi_clear" name="tgi_clear">
685 <item><ref id="tgi_done" name="tgi_done">
686 <item><ref id="tgi_ellipse" name="tgi_ellipse">
687 <item><ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
688 <item><ref id="tgi_getaspectratio" name="tgi_getaspectratio">
689 <item><ref id="tgi_getcolor" name="tgi_getcolor">
690 <item><ref id="tgi_getcolorcount" name="tgi_getcolorcount">
691 <item><ref id="tgi_getdefpalette" name="tgi_getdefpalette">
692 <item><ref id="tgi_geterror" name="tgi_geterror">
693 <item><ref id="tgi_geterrormsg" name="tgi_geterrormsg">
694 <item><ref id="tgi_getmaxcolor" name="tgi_getmaxcolor">
695 <item><ref id="tgi_getmaxx" name="tgi_getmaxx">
696 <item><ref id="tgi_getmaxy" name="tgi_getmaxy">
697 <item><ref id="tgi_getpagecount" name="tgi_getpagecount">
698 <item><ref id="tgi_getpalette" name="tgi_getpalette">
699 <item><ref id="tgi_getpixel" name="tgi_getpixel">
700 <item><ref id="tgi_gettextheight" name="tgi_gettextheight">
701 <item><ref id="tgi_gettextwidth" name="tgi_gettextwidth">
702 <item><ref id="tgi_getxres" name="tgi_getxres">
703 <item><ref id="tgi_getyres" name="tgi_getyres">
704 <item><ref id="tgi_gotoxy" name="tgi_gotoxy">
705 <item><ref id="tgi_init" name="tgi_init">
706 <item><ref id="tgi_install" name="tgi_install">
707 <item><ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
708 <item><ref id="tgi_ioctl" name="tgi_ioctl">
709 <item><ref id="tgi_line" name="tgi_line">
710 <item><ref id="tgi_lineto" name="tgi_lineto">
711 <item><ref id="tgi_load_driver" name="tgi_load_driver">
712 <item><ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">
713 <item><ref id="tgi_outtext" name="tgi_outtext">
714 <item><ref id="tgi_outtextxy" name="tgi_outtextxy">
715 <item><ref id="tgi_setaspectratio" name="tgi_setaspectratio">
716 <item><ref id="tgi_setcolor" name="tgi_setcolor">
717 <item><ref id="tgi_setdrawpage" name="tgi_setdrawpage">
718 <item><ref id="tgi_setpalette" name="tgi_setpalette">
719 <item><ref id="tgi_setpixel" name="tgi_setpixel">
720 <item><ref id="tgi_setviewpage" name="tgi_setviewpage">
721 <item><ref id="tgi_settextscale" name="tgi_settextscale">
722 <item><ref id="tgi_settextstyle" name="tgi_settextstyle">
723 <item><ref id="tgi_uninstall" name="tgi_uninstall">
724 <item><ref id="tgi_unload" name="tgi_unload">
727 <sect1><tt/time.h/<label id="time.h"><p>
730 <!-- <item><ref id="_systime" name="_systime"> -->
731 <!-- <item><ref id="asctime" name="asctime"> -->
732 <item><ref id="clock" name="clock">
733 <!-- <item><ref id="ctime" name="ctime"> -->
734 <!-- <item><ref id="gmtime" name="gmtime"> -->
735 <!-- <item><ref id="localtime" name="localtime"> -->
736 <!-- <item><ref id="mktime" name="mktime"> -->
737 <!-- <item><ref id="strftime" name="strftime"> -->
738 <item><ref id="time" name="time">
744 <sect1><tt/unistd.h/<label id="unistd.h"><p>
747 <!-- <item><ref id="chdir" name="chdir"> -->
748 <item><ref id="exec" name="exec">
749 <!-- <item><ref id="getcwd" name="getcwd"> -->
750 <item><ref id="getopt" name="getopt">
751 <!-- <item><ref id="lseek" name="lseek"> -->
752 <!-- <item><ref id="mkdir" name="mkdir"> -->
753 <!-- <item><ref id="read" name="read"> -->
754 <!-- <item><ref id="rmdir" name="rmdir"> -->
755 <item><ref id="sleep" name="sleep">
756 <item><ref id="unlink" name="unlink">
757 <!-- <item><ref id="write" name="write"> -->
763 <sect1><tt/vic20.h/<label id="vic20.h"><p>
768 <sect1><tt/zlib.h/<label id="zlib.h"><p>
771 <!-- <item><ref id="adler32" name="adler32"> -->
772 <!-- <item><ref id="crc32" name="crc32"> -->
773 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
774 <!-- <item><ref id="uncompress" name="uncompress"> -->
780 <sect>Alphabetical function reference<p>
782 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
786 <tag/Function/Determine if a directory entry specifies a directory.
787 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
788 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
789 <tag/Description/The function is called with the type of a directory entry
790 taken from a <tt/struct dirent/ and returns true if the entry designates
793 <item>The function is actually a macro.
795 <tag/Availability/cc65
797 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
798 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
799 <ref id="_DE_ISREG" name="_DE_ISREG">
805 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
809 <tag/Function/Determine if a directory entry specifies a disk label.
810 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
811 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
812 <tag/Description/The function is called with the type of a directory entry
813 taken from a <tt/struct dirent/ and returns true if the entry designates
816 <item>The function is actually a macro.
818 <tag/Availability/cc65
820 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
821 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
822 <ref id="_DE_ISREG" name="_DE_ISREG">
828 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
832 <tag/Function/Determine if a directory entry specifies a link.
833 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
834 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
835 <tag/Description/The function is called with the type of a directory entry
836 taken from a <tt/struct dirent/ and returns true if the entry designates
839 <item>The function is actually a macro.
841 <tag/Availability/cc65
843 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
844 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
845 <ref id="_DE_ISREG" name="_DE_ISREG">
851 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
855 <tag/Function/Determine if a directory entry specifies a regular file.
856 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
857 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
858 <tag/Description/The function is called with the type of a directory entry
859 taken from a <tt/struct dirent/ and returns true if the entry designates
862 <item>The function is actually a macro.
863 <item>A "regular file" means anything with data in it. This might still mean
864 that special processing is needed, when accessing the file. Relative files of
865 the CBM systems are classified as being "regular" files, for example.
867 <tag/Availability/cc65
869 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
870 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
871 <ref id="_DE_ISLNK" name="_DE_ISLNK">
877 <sect1>_heapadd<label id="_heapadd"><p>
881 <tag/Function/Add a block to the heap.
882 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
883 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
884 <tag/Description/The function adds a block of raw memory to the heap.
886 <item>The minimum blocksize that can be added is 6 bytes; the function will
887 ignore smaller blocks.
888 <item>The function is available only as a fastcall function; so, it may be used
889 only in the presence of a prototype.
891 <tag/Availability/cc65
893 <ref id="_heapblocksize" name="_heapblocksize">,
894 <ref id="_heapmaxavail" name="_heapmaxavail">,
895 <ref id="_heapmemavail" name="_heapmemavail">,
896 <ref id="calloc" name="calloc">,
897 <ref id="free" name="free">,
898 <ref id="malloc" name="malloc">,
899 <ref id="realloc" name="realloc">
905 <sect1>_heapblocksize<label id="_heapblocksize"><p>
909 <tag/Function/Return the size of an allocated block.
910 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
911 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
912 <tag/Description/The function returns the size of a block that must have
913 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
914 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
916 <item>Passing a pointer to a block that was is not the result of one of the
917 allocation functions, or that has been free'd will give unpredicable results.
918 <item>The function is available only as a fastcall function; so, it may be used
919 only in the presence of a prototype.
921 <tag/Availability/cc65
923 <ref id="_heapadd" name="_heapadd">,
924 <ref id="_heapmaxavail" name="_heapmaxavail">,
925 <ref id="_heapmemavail" name="_heapmemavail">,
926 <ref id="calloc" name="calloc">,
927 <ref id="free" name="free">,
928 <ref id="malloc" name="malloc">,
929 <ref id="realloc" name="realloc">
935 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
939 <tag/Function/Return the largest block that is available on the heap.
940 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
941 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
942 <tag/Description/The function returns the size of the largest block that may
943 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
944 <tag/Availability/cc65
946 <ref id="_heapadd" name="_heapadd">,
947 <ref id="_heapblocksize" name="_heapblocksize">,
948 <ref id="_heapmemavail" name="_heapmemavail">,
949 <ref id="calloc" name="calloc">,
950 <ref id="free" name="free">,
951 <ref id="malloc" name="malloc">,
952 <ref id="realloc" name="realloc">
958 <sect1>_heapmemavail<label id="_heapmemavail"><p>
962 <tag/Function/Return the total available space on the heap.
963 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
964 <tag/Declaration/<tt/size_t _heapmemavail (void);/
965 <tag/Description/The function returns the total number of bytes available on
968 <item>This function is of less use than usually assumed, since the returned
969 heap space may be available but not in one block. So even if this function
970 says that several times more heap space is available than needed, <ref
971 id="malloc" name="malloc"> may still return <tt/NULL/.
973 <tag/Availability/cc65
975 <ref id="_heapadd" name="_heapadd">,
976 <ref id="_heapblocksize" name="_heapblocksize">,
977 <ref id="_heapmaxavail" name="_heapmaxavail">,
978 <ref id="calloc" name="calloc">,
979 <ref id="free" name="free">,
980 <ref id="malloc" name="malloc">,
981 <ref id="realloc" name="realloc">
987 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
991 <tag/Function/Determines whether the underlying DOS supports command line arguments.
992 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
993 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
994 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
995 It returns 1 if it does.
996 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1001 <sect1>_poserror<label id="_poserror"><p>
1005 <tag/Function/Print an error message for the error in <tt/_oserror/.
1006 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1007 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1008 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1009 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1010 a colon and a blank. Then the error message for the current contents of
1011 <tt/_oserror/ are printed followed by a newline. The message output is the
1012 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1013 argument of <tt/_oserror/.
1014 <tag/Notes/<itemize>
1015 <item>Since operating system specific error code are - you guessed it -
1016 operating system specific, the value in <tt/_oserror/ and the message that is
1017 printed depends on the cc65 target.
1018 <item>The function is only available as fastcall function, so it may only
1019 be used in presence of a prototype.
1021 <tag/Availability/cc65
1023 <ref id="_stroserror" name="_stroserror">,
1024 <ref id="perror" name="perror">
1030 <sect1>_randomize<label id="_randomize"><p>
1034 <tag/Function/Initialize the pseudo random number generator.
1035 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1036 <tag/Declaration/<tt/void _randomize (void);/
1037 <tag/Description/The function initializes the random number generator with
1038 a seed derived from fast changing hardware events, so the seed itself can be
1039 considered random to a certain degree.
1040 <tag/Notes/<itemize>
1041 <item>The randomness of the seed depends on the machine hardware.
1043 <tag/Availability/cc65
1045 <ref id="rand" name="rand">,
1046 <ref id="srand" name="srand">
1052 <sect1>_stroserror<label id="_stroserror"><p>
1056 <tag/Function/Return a string describing an OS specific error code.
1057 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1058 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1059 <tag/Description/<tt/_stroserror/ will return a string describing the given
1060 operating system specific error code.
1061 <tag/Notes/<itemize>
1062 <item>Since operating system specific error code are - you guessed it -
1063 operating system specific, the parameter and the string returned depend on the
1065 <item>The function is only available as fastcall function, so it may only be
1066 used in presence of a prototype.
1068 <tag/Availability/cc65
1070 <ref id="strerror" name="strerror">
1076 <sect1>_swap<label id="_swap"><p>
1080 <tag/Function/Swap the contents of memory areas.
1081 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1082 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1083 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1084 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1085 <tt/size/ bytes in size.
1086 <tag/Notes/<itemize>
1087 <item>The memory areas may not overlap, otherwise the results are undefined.
1088 <item>The function is only available as fastcall function, so it may only be
1089 used in presence of a prototype.
1091 <tag/Availability/cc65
1093 <ref id="memcpy" name="memcpy">,
1094 <ref id="memmove" name="memmove">
1100 <sect1>_sys<label id="_sys"><p>
1104 <tag/Function/Call a subroutine passing register values.
1105 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1106 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1107 <tag/Description/The function will call the subroutine at the address
1108 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1109 registers and the CPU flags are set to the values given in the <tt/regs/
1110 structure. On return from the subroutine, the new values of the registers and
1111 flags are stored back overwriting the old values.
1112 <tag/Notes/<itemize>
1113 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1114 when calling the subroutine (they are unchanged from their current values).
1115 <item>The function is only available as fastcall function, so it may only be
1116 used in presence of a prototype.
1118 <tag/Availability/cc65
1124 <sect1>BRK<label id="BRK"><p>
1128 <tag/Function/Insert a 6502 BRK instrunction into the code.
1129 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1130 <tag/Declaration/<tt/void BRK (void);/
1131 <tag/Description/The function will insert a 6502 BRK instruction into the code
1132 which may be used to trigger a debugger.
1133 <tag/Notes/<itemize>
1134 <item>The function is actually a macro.
1135 <item>The inserted instruction may lead to unexpected results if no debugger
1138 <tag/Availability/cc65
1140 <ref id="CLI" name="CLI">,
1141 <ref id="SEI" name="SEI">
1147 <sect1>CLI<label id="CLI"><p>
1151 <tag/Function/Insert a 6502 CLI instrunction into the code.
1152 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1153 <tag/Declaration/<tt/void CLI (void);/
1154 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1155 so interrupts are enabled. Enabling interrupts has no effects if they are
1156 already enabled (the default).
1157 <tag/Notes/<itemize>
1158 <item>The function is actually a macro.
1159 <item>Disabling interrupts may lead to unexpected results.
1161 <tag/Availability/cc65
1163 <ref id="BRK" name="BRK">,
1164 <ref id="SEI" name="SEI">
1170 <sect1>PEEK<label id="PEEK"><p>
1174 <tag/Function/Read a byte from memory.
1175 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1176 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1177 <tag/Description/The function will read the absolute memory given by <tt/addr/
1178 and return the value read.
1179 <tag/Notes/<itemize>
1180 <item>The function is actually a macro.
1181 <item>This function depends highly on the platform and environment.
1183 <tag/Availability/cc65
1185 <ref id="PEEKW" name="PEEKW">,
1186 <ref id="POKE" name="POKE">
1192 <sect1>PEEKW<label id="PEEKW"><p>
1196 <tag/Function/Read a word (two bytes) from memory.
1197 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1198 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1199 <tag/Description/The function will read the absolute memory given by <tt/addr/
1200 and return the value read. The byte read from the higher address is the high
1201 byte of the return value.
1202 <tag/Notes/<itemize>
1203 <item>The function is actually a macro.
1204 <item>This function depends highly on the platform and environment.
1205 <item>The order in which the two bytes are read is unspecified and may
1206 depend of the address expression used.
1208 <tag/Availability/cc65
1210 <ref id="PEEK" name="PEEK">,
1211 <ref id="POKE" name="POKE">
1217 <sect1>POKE<label id="POKE"><p>
1221 <tag/Function/Write a byte to memory.
1222 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1223 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1224 <tag/Description/The function writes the value <tt/val/ to the absolute
1225 memory address given by <tt/addr/.
1226 <tag/Notes/<itemize>
1227 <item>The function is actually a macro.
1228 <item>This function depends highly on the platform and environment.
1229 <item>Careless use will cause the program to act strange or may crash the
1232 <tag/Availability/cc65
1234 <ref id="PEEK" name="PEEK">,
1235 <ref id="POKEW" name="POKEW">
1241 <sect1>POKEW<label id="POKEW"><p>
1245 <tag/Function/Write a word (two bytes) to memory.
1246 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1247 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1248 <tag/Description/The function writes the value <tt/val/ to the absolute
1249 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1250 the <tt/addr/, the high byte is written to <tt/addr+1/.
1251 <tag/Notes/<itemize>
1252 <item>The function is actually a macro.
1253 <item>This function depends highly on the platform and environment.
1254 <item>Careless use will cause the program to act strange or may crash the
1256 <item>The order in which the two bytes are written is unspecified and may
1257 depend of the address expression used.
1259 <tag/Availability/cc65
1261 <ref id="PEEK" name="PEEK">,
1262 <ref id="POKE" name="POKE">
1268 <sect1>SEI<label id="SEI"><p>
1272 <tag/Function/Insert a 6502 SEI instrunction into the code.
1273 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1274 <tag/Declaration/<tt/void SEI (void);/
1275 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1276 so interrupts are disabled. Note that non maskable interrupts cannot be
1278 <tag/Notes/<itemize>
1279 <item>The function is actually a macro.
1280 <item>Disabling interrupts may lead to unexpected results.
1282 <tag/Availability/cc65
1284 <ref id="BRK" name="BRK">,
1285 <ref id="CLI" name="CLI">
1291 <sect1>abort<label id="abort"><p>
1295 <tag/Function/Terminates a program abnormally.
1296 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1297 <tag/Declaration/<tt/void abort (void);/
1298 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1299 on stderr, then terminates the program with an exit code of 3.
1300 <tag/Availability/ISO 9899
1302 <ref id="assert" name="assert">,
1303 <ref id="exit" name="exit">,
1304 <ref id="raise" name="raise">
1310 <sect1>abs<label id="abs"><p>
1314 <tag/Function/Returns the absolute value of an integer.
1315 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1316 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1317 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1319 <tag/Notes/<itemize>
1320 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1321 <item>The function is only available as fastcall function, so it may only be
1322 used in presence of a prototype.
1324 <tag/Availability/ISO 9899
1326 <ref id="labs" name="labs">
1332 <sect1>assert<label id="assert"><p>
1336 <tag/Function/Test a condition and possibly abort.
1337 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1338 <tag/Declaration/<tt/void assert (int cond);/
1339 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1340 statement. If the condition evaluates t zero (false), assert prints a message
1341 on stderr and aborts the program.
1342 <tag/Notes/<itemize>
1343 <item>The function is actually a macro.
1345 <tag/Availability/ISO 9899
1347 <ref id="abort" name="abort">,
1348 <ref id="exit" name="exit">
1354 <sect1>atexit<label id="atexit"><p>
1358 <tag/Function/Register an exit function.
1359 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1360 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1361 <tag/Description/<tt/atexit/ registers the function pointed to by
1362 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1363 terminates, they are called in LIFO order (the last function registered is
1364 called first). <tt/atexit/ returns zero on success and a nonzero value on
1366 <tag/Notes/<itemize>
1367 <item>A maximum of 5 exit functions can be registered.
1368 <item>There is no way to unregister an exit function.
1369 <item>The function is only available as fastcall function, so it may only be
1370 used in presence of a prototype.
1372 <tag/Availability/ISO 9899
1374 <ref id="abort" name="abort">,
1375 <ref id="exit" name="exit">
1381 <sect1>atmos_load<label id="atmos_load"><p>
1385 <tag/Function/Load Atmos tape.
1386 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1387 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1388 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1389 <tag/Notes/<itemize>
1390 <item>The function is available only as a fastcall function; so, it may be used
1391 only in the presence of a prototype.
1393 <tag/Availability/cc65
1395 <ref id="atmos_save" name="atmos_save">
1401 <sect1>atmos_save<label id="atmos_save"><p>
1405 <tag/Function/Save Atmos tape.
1406 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1407 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1408 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1409 <tag/Notes/<itemize>
1410 <item>The function is available only as a fastcall function; so, it may be used
1411 only in the presence of a prototype.
1413 <tag/Availability/cc65
1415 <ref id="atmos_load" name="atmos_load">
1417 atmos_save("hires", 0xa000, 0xc000);
1423 <sect1>atoi<label id="atoi"><p>
1427 <tag/Function/Convert a string to an integer.
1428 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1429 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1430 <tag/Description/<tt/atoi/ converts the given string into an integer.
1431 Conversion stops as soon as any invalid character is encountered.
1432 <tag/Notes/<itemize>
1433 <item>There is no way to detect any conversion errors.
1434 <item>The function does not check for an numerical overflow when converting.
1435 <item>The function is only available as fastcall function, so it may only be
1436 used in presence of a prototype.
1438 <tag/Availability/ISO 9899
1440 <ref id="atol" name="atol">,
1441 <ref id="itoa" name="itoa">,
1442 <ref id="ltoa" name="ltoa">,
1443 <ref id="ultoa" name="ultoa">,
1444 <ref id="utoa" name="utoa">
1450 <sect1>atol<label id="atol"><p>
1454 <tag/Function/Convert a string to a long integer.
1455 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1456 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1457 <tag/Description/<tt/atol/ converts the given string into a long integer.
1458 Conversion stops as soon as any invalid character is encountered.
1459 <tag/Notes/<itemize>
1460 <item>There is no way to detect any conversion errors.
1461 <item>The function does not check for an numerical overflow when converting.
1462 <item>The function is only available as fastcall function, so it may only be
1463 used in presence of a prototype.
1465 <tag/Availability/ISO 9899
1467 <ref id="atoi" name="atoi">,
1468 <ref id="itoa" name="itoa">,
1469 <ref id="ltoa" name="ltoa">,
1470 <ref id="ultoa" name="ultoa">,
1471 <ref id="utoa" name="utoa">
1477 <sect1>bgcolor<label id="bgcolor"><p>
1481 <tag/Function/Set the background text color.
1482 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1483 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1484 <tag/Description/The function will set a new background color and return the
1485 old (current) one. The background color is valid for the whole text output
1486 area of the screen, not just for new text.
1487 <tag/Notes/<itemize>
1488 <item>Background colors are system dependent. The function may have no effect
1489 on systems where the background color cannot be changed.
1490 <item>The function is only available as fastcall function, so it may only be
1491 used in presence of a prototype.
1493 <tag/Availability/cc65
1495 <ref id="bordercolor" name="bordercolor">,
1496 <ref id="textcolor" name="textcolor">
1502 <sect1>bordercolor<label id="bordercolor"><p>
1506 <tag/Function/Set the border (frame) color.
1507 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1508 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1509 <tag/Description/The function will set a new border color. It returns the old
1510 (current) border color.
1511 <tag/Notes/<itemize>
1512 <item>Border colors are system dependent. The function may have no effect
1513 on systems where the border color cannot be changed.
1514 <item>The function is only available as fastcall function, so it may only
1515 be used in presence of a prototype.
1517 <tag/Availability/cc65
1519 <ref id="bgcolor" name="bgcolor">,
1520 <ref id="textcolor" name="textcolor">
1526 <sect1>bsearch<label id="bsearch"><p>
1530 <tag/Function/Do a binary search in a sorted array.
1531 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1532 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1533 const void* base, size_t n, size_t size,
1534 int __fastcall__ (* cmp) (const void*, const void*));/
1535 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1536 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1537 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1538 the function used to compare the members against the key. The function returns
1539 a pointer to the member found, or <tt/NULL/ if there was no match.
1540 <tag/Notes/<itemize>
1541 <item>The contents of the array must be sorted in ascending order according to
1542 the compare function given.
1543 <item>If there are multiple members that match the key, the function will
1544 return one of the members.
1545 <item>The function is only available as fastcall function, so it may only
1546 be used in presence of a prototype.
1547 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1550 <tag/Availability/ISO 9899
1552 <ref id="qsort" name="qsort">
1558 <sect1>bzero<label id="bzero"><p>
1562 <tag/Function/Fill a memory area with zeroes.
1563 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1564 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1565 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1567 <tag/Notes/<itemize>
1568 <item>The function is non standard and therefore only available in non ANSI
1569 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1570 <item>The function is only available as fastcall function, so it may only
1571 be used in presence of a prototype.
1573 <tag/Availability/cc65
1575 <ref id="_swap" name="_swap">,
1576 <ref id="memcpy" name="memcpy">,
1577 <ref id="memmove" name="memmove">,
1578 <ref id="memset" name="memset">,
1584 <sect1>c64mode<label id="c64mode"><p>
1588 <tag/Function/Switch the C128 into C64 compatible mode.
1589 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1590 <tag/Declaration/<tt/void c64mode (void);/
1591 <tag/Description/The function will cause the machine to reboot into C64 mode.
1592 <tag/Notes/<itemize>
1593 <item>The function is specific to the C128.
1594 <item>The function will not return to the caller.
1596 <tag/Availability/C128
1602 <sect1>calloc<label id="calloc"><p>
1606 <tag/Function/Allocate and clear memory.
1607 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1608 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1609 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1610 of size <tt/size/, clears the whole block with binary zeroes and returns a
1611 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1613 <tag/Notes/<itemize>
1614 <item>Clearing the memory may not have the expected effect on all platforms:
1615 pointers in the block may not be <tt/NULL/ and floating point variables may
1616 not be zero (0.0). In other words: The "clearing" effect of this function
1617 should be used with care for portable programs.
1618 <item>The function is only available as fastcall function, so it may only
1619 be used in presence of a prototype.
1621 <tag/Availability/ISO 9899
1623 <ref id="_heapadd" name="_heapadd">,
1624 <ref id="_heapblocksize" name="_heapblocksize">,
1625 <ref id="_heapmaxavail" name="_heapmaxavail">,
1626 <ref id="_heapmemavail" name="_heapmemavail">,
1627 <ref id="free" name="free">,
1628 <ref id="malloc" name="malloc">,
1629 <ref id="realloc" name="realloc">
1635 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1639 <tag/Function/Input byte from serial bus
1640 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1641 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1642 <tag/Description/The function returns a byte of data, which it
1643 gets from the current TALKer on the serial bus.
1644 In order to receive the data, the device must have previously been
1645 sent a command to TALK and a secondary address if it needs one.
1646 <tag/Notes/<itemize>
1649 <tag/Availability/cc65
1651 <ref id="cbm_k_talk" name="cbm_k_talk">,
1657 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1661 <tag/Function/Input a Character from the Current Device
1662 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1663 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1664 <tag/Description/The function returns a character from the current input device.
1665 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1666 When this function is called, the next byte of data available from the device is returned.
1667 Exception is the routine for the keyboard device (which is the default input device).
1668 <tag/Notes/<itemize>
1671 <tag/Availability/cc65
1673 <ref id="cbm_k_open" name="cbm_k_open">,
1674 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1680 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1684 <tag/Function/Output a byte
1685 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1686 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1687 <tag/Description/Function sends the character to the current output device.
1688 Unless a device has been OPENed and designated as the
1689 current output channel using the CHKOUT routine, the character is
1690 printed to the screen, which is the default output device. If the
1691 cassette is the current device, outputting a byte will only add it to
1692 the buffer. No actual transmission of data will occur until the
1693 192-byte buffer is full.
1694 <tag/Notes/<itemize>
1695 <item>The function is only available as fastcall function, so it may
1696 only be used in presence of a prototype.
1698 <tag/Availability/cc65
1700 <ref id="cbm_k_open" name="cbm_k_open">,
1701 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1707 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1711 <tag/Function/Designate a Logical File As the Current Input Channel
1712 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1713 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1714 <tag/Description/If you wish to
1715 get data from any device other than the keyboard, this function must be
1716 called after OPENing the device, before you can get a data byte with
1717 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1718 the logical file whose file number was supplied as the
1719 current file, its device as the current device, and its secondary
1720 address as the current secondary address. If the device on the
1721 channel is a serial device, which requires a TALK command and
1722 sometimes a secondary address, function will send them over the
1724 <tag/Notes/<itemize>
1725 <item>The function is only available as fastcall function, so it may
1726 only be used in presence of a prototype.
1728 <tag/Availability/cc65
1730 <ref id="cbm_k_open" name="cbm_k_open">,
1731 <ref id="cbm_k_basin" name="cbm_k_basin">,
1732 <ref id="cbm_k_getin" name="cbm_k_getin">
1738 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1742 <tag/Function/Transmit a byte over the serial bus
1743 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1744 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1745 <tag/Description/Purpose of this function is to send a byte of data over
1746 the serial bus. In order for the data to be received, the serial
1747 device must have first been commanded to LISTEN and been given a
1748 secondary address if necessary. This routine always buffers the
1749 current character, and defers sending it until the next byte is
1750 buffered. When the UNLISTEN command is sent, the last byte will be
1751 sent with an End or Identify (EOI).
1752 <tag/Notes/<itemize>
1753 <item>The function is only available as fastcall function, so it may
1754 only be used in presence of a prototype.
1756 <tag/Availability/cc65
1758 <ref id="cbm_k_listen" name="cbm_k_listen">,
1759 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1765 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1769 <tag/Function/Designate a Logical File As the Current Output Channel
1770 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1771 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1772 <tag/Description/If you wish to
1773 output data to any device other than the screen, this routine must be
1774 called after OPENing the device, and before you output a data byte
1775 with the cbm_k_bsout() function. When called, the function will designate the
1776 logical file whose file number was supplied as the current
1777 file, its device as the current device, and its secondary address as
1778 the current secondary address. If the device on the channel uses the
1779 serial bus, and therefore requires a LISTEN command and possibly a
1780 secondary address, this information will be sent on the bus.
1781 <tag/Notes/<itemize>
1782 <item>The function is only available as fastcall function, so it may
1783 only be used in presence of a prototype.
1785 <tag/Availability/cc65
1787 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1788 <ref id="cbm_k_listen" name="cbm_k_listen">
1794 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1798 <tag/Function/Close All Logical I/O Files
1799 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1800 <tag/Declaration/<tt/void cbm_k_clall (void);/
1801 <tag/Description/It closes all
1802 open files, by resetting the index into open files to
1803 zero and restores the default I/O devices.
1804 <tag/Notes/<itemize>
1807 <tag/Availability/cc65
1809 <ref id="cbm_k_open" name="cbm_k_open">,
1810 <ref id="cbm_k_close" name="cbm_k_close">
1816 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1820 <tag/Function/Close a Logical I/O File
1821 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1822 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1823 <tag/Description/It is used to
1824 close a logical file after all I/O operations involving that file have
1826 <tag/Notes/<itemize>
1827 <item>The function is only available as fastcall function, so it may
1828 only be used in presence of a prototype.
1830 <tag/Availability/cc65
1832 <ref id="cbm_k_open" name="cbm_k_open">,
1833 <ref id="cbm_k_clall" name="cbm_k_clall">
1839 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1843 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1844 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1845 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1846 <tag/Description/It sets the
1847 current input device to the keyboard, and the current output device to
1848 the screen. Also, if the current input device was formerly a serial
1849 device, the routine sends it an UNTALK command on the serial bus, and
1850 if a serial device was formerly the current output device, the routine
1851 sends it an UNLISTEN command.
1852 <tag/Notes/<itemize>
1855 <tag/Availability/cc65
1857 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
1858 <ref id="cbm_k_ckout" name="cbm_k_ckout">
1864 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
1868 <tag/Function/Get One Byte from the Input Device
1869 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1870 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
1871 <tag/Description/Function gets a character from the current input device.
1872 <tag/Notes/<itemize>
1875 <tag/Availability/cc65
1877 <ref id="cbm_k_basin" name="cbm_k_basin">
1883 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
1887 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
1888 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1889 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
1890 <tag/Description/This function returns the address of
1891 the memory section where the memory mapped I/O devices are located. This
1892 address can then be used with an offset to access the memory mapped I/O
1893 devices in the Commodore 64. The offset is the number of locations from
1894 the beginning of the page on which the I/O register you want is located.
1895 This function exists to provide compatibility between the Commodore 64,
1896 VIC-20, and future models of the Commodore 64. If the I/O locations for
1897 a program are set by a call to this function, they should
1898 still remain compatible with future versions of the Commodore 64, the
1900 <tag/Notes/<itemize>
1903 <tag/Availability/cc65
1911 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
1915 <tag/Function/Command a device on the serial bus to LISTEN
1916 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1917 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
1918 <tag/Description/This function will command a device on the serial bus to
1919 receive data. The KERNAL routine will OR the supplied device number bit by bit
1920 to convert it to a listen address, then transmits this data as a command on
1921 the serial bus. The specified device will then go into listen mode, and
1922 be ready to accept information.
1923 <tag/Notes/<itemize>
1924 <item>The function is only available as fastcall function, so it may
1925 only be used in presence of a prototype.
1927 <tag/Availability/cc65
1929 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
1935 <sect1>cbm_k_load<label id="cbm_k_load"><p>
1939 <tag/Function/Load RAM from a Device
1940 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1941 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
1942 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
1943 It can also be used for a verify operation, comparing data from a device with the data already in
1944 memory, while leaving the data stored in RAM unchanged.
1945 The flag must be set to 0 for a LOAD operation, or 1 for a
1946 verify, If the input device is OPENed with a secondary address (SA) of 0
1947 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
1948 If the device is addressed with a secondary address of 1, then the data is
1949 loaded into memory starting at the location specified by the header.
1950 Function returns the address of the highest RAM location loaded.
1951 Before this function can be called, the KERNAL SETLFS, and SETNAM
1952 routines must be called.
1953 <tag/Notes/<itemize>
1954 <item>The function is only available as fastcall function, so it may
1955 only be used in presence of a prototype.
1957 <tag/Availability/cc65
1959 <ref id="cbm_k_save" name="cbm_k_save">,
1960 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1961 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1967 <sect1>cbm_k_open<label id="cbm_k_open"><p>
1971 <tag/Function/Open a Logical I/O File
1972 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1973 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
1974 <tag/Description/This function assigns a logical file to a device, so that it can be used for
1975 Input/Output operations. In order to specify the logical file number,
1976 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
1977 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
1978 functions are called, cbm_k_open() is then called.
1979 <tag/Notes/<itemize>
1982 <tag/Availability/cc65
1984 <ref id="cbm_k_close" name="cbm_k_close">,
1985 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1986 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1992 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
1996 <tag/Function/Read status word
1997 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1998 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
1999 <tag/Description/This function returns the current status of the I/O devices. It is usually called after new communication to an I/O device and gives information about device status, or errors that have occurred during the I/O operation.
2000 <tag/Notes/<itemize>
2003 <tag/Availability/cc65
2011 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2015 <tag/Function/Save RAM to a Device
2016 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2017 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2018 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2019 used before calling this function. However, a file name is not required to
2020 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2021 other devices without using a file name results in an error. NOTE: Device 0 (the keyboard), device 2 (RS-232), and device 3 (the screen) cannot be SAVEd to. If the attempt is made, an error occurs, and the SAVE is stopped.
2022 <tag/Notes/<itemize>
2023 <item>The function is only available as fastcall function, so it may
2024 only be used in presence of a prototype.
2026 <tag/Availability/cc65
2028 <ref id="cbm_k_load" name="cbm_k_load">,
2029 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2030 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2036 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2040 <tag/Function/Scan the keyboard matrix.
2041 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2042 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2043 <tag/Description/This function looks at the switches in the keyboard, to see
2044 if any of them are being pressed. If they are, then code numbers for them are
2045 stored in RAM. Other functions use those numbers to input text. Normally,
2046 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2047 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2048 function, in order to provide input from the keyboard.
2049 <tag/Availability/cc65
2051 <ref id="cbm_k_getin" name="cbm_k_getin">,
2052 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2053 <ref id="cgetc" name="cgetc">,
2054 <!-- <ref id="getc" name="getc"> -->
2055 <!-- <ref id="getchar" name="getchar"> -->
2061 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2065 <tag/Function/Set up a logical file
2066 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2067 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2068 <tag/Description/This functions sets up the logical file by setting its number, device address,
2069 and secondary address.
2070 <tag/Notes/<itemize>
2071 <item>The function is only available as fastcall function, so it may
2072 only be used in presence of a prototype.
2074 <tag/Availability/cc65
2076 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2082 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2086 <tag/Function/Set Filename Parameters
2087 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2088 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2089 <tag/Description/This function is used to set up the file name for the OPEN,
2090 SAVE, or LOAD operations.
2091 <tag/Notes/<itemize>
2092 <item>The function is only available as fastcall function, so it may
2093 only be used in presence of a prototype.
2095 <tag/Availability/cc65
2097 <ref id="cbm_k_open" name="cbm_k_open">,
2098 <ref id="cbm_k_load" name="cbm_k_load">,
2099 <ref id="cbm_k_save" name="cbm_k_save">
2105 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2109 <tag/Function/Commands device to TALK
2110 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2111 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2112 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2113 bus. This commands the device to TALK.
2114 <tag/Notes/<itemize>
2115 <item>The function is only available as fastcall function, so it may
2116 only be used in presence of a prototype.
2118 <tag/Availability/cc65
2120 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2126 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2130 <tag/Function/Update the Jiffy clock.
2131 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2132 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2133 <tag/Description/This function adds one count to the Jiffy clock. That clock
2134 counts sixtieths of a second. It is used by the library's <tt/clock()/
2135 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2136 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2137 then that ISR must call this function, in order to keep the clock valid.
2138 <tag/Availability/cc65
2140 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2141 <ref id="clock" name="clock">
2147 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2151 <tag/Function/Send an UNLISTEN command
2152 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2153 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2154 <tag/Description/This function commands all devices on the serial bus to
2155 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2156 function results in an UNLISTEN command being transmitted on the serial
2157 bus. Only devices previously commanded to LISTEN are affected. This
2158 function is normally used after the host computer is finished sending data
2159 to external devices. Sending the UNLISTEN commands the listening devices
2160 to get off the serial bus so it can be used for other purposes.
2161 <tag/Notes/<itemize>
2164 <tag/Availability/cc65
2166 <ref id="cbm_k_listen" name="cbm_k_listen">
2171 <sect1>kbrepeat<label id="kbrepeat"><p>
2175 <tag/Function/Set keyboard repeat mode
2176 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2177 <tag/Declaration/<tt/unsigned char kbrepeat (unsigned char);/
2178 <tag/Description/This function changes what keys will have automatic repeat when
2179 being hold down for a certain time. Possible values are KBDREPEAT_CURSOR (repeat
2180 only cursor-related keys), KBDREPEAT_NONE (no repeat for any keys) and
2181 KBDREPEAT_ALL (repeat all keys).
2182 The old mode is returned so it can be restored later.
2183 <tag/Notes/<itemize>
2186 <tag/Availability/cc65
2188 <ref id="kbrepeatdelay" name="kbrepeatdelay">
2189 <ref id="kbrepeatrate" name="kbrepeatrate">
2194 <sect1>kbrepeatdelay<label id="kbrepeatdelay"><p>
2198 <tag/Function/Set keyboard repeat delay
2199 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2200 <tag/Declaration/<tt/unsigned char kbrepeatdelay (unsigned char);/
2201 <tag/Description/This function changes the delay until a keypress is being
2202 repeated automatically.
2203 The old value is returned so it can be restored later.
2204 <tag/Notes/<itemize>
2207 <tag/Availability/cc65
2209 <ref id="kbrepeat" name="kbrepeat">
2210 <ref id="kbrepeatrate" name="kbrepeatrate">
2215 <sect1>kbrepeatrate<label id="kbrepeatrate"><p>
2219 <tag/Function/Set keyboard repeat rate
2220 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2221 <tag/Declaration/<tt/unsigned char kbrepeatrate (unsigned char);/
2222 <tag/Description/This function changes the keyboard repeat rate (the time between
2223 repeated keypresses).
2224 The old value is returned so it can be restored later.
2225 <tag/Notes/<itemize>
2228 <tag/Availability/cc65
2230 <ref id="kbrepeat" name="kbrepeat">
2231 <ref id="kbrepeatdelay" name="kbrepeatdelay">
2236 <sect1>cclear<label id="cclear"><p>
2240 <tag/Function/Clear part of a line (write a given number of spaces).
2241 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2242 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2243 <tag/Description/The function clears part of a line by writing <tt/length/
2244 spaces in the current text color.
2245 <tag/Notes/<itemize>
2246 <item>The function is only available as fastcall function, so it may
2247 only be used in presence of a prototype.
2249 <tag/Availability/cc65
2251 <ref id="cclearxy" name="cclearxy">,
2252 <ref id="clrscr" name="clrscr">
2258 <sect1>cclearxy<label id="cclearxy"><p>
2262 <tag/Function/Clear part of a line (write a given number of spaces) starting
2263 at a specific screen position.
2264 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2265 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2266 <tag/Description/The function moves the cursor to a specific position, and
2267 will then clear part of the line by writing <tt/length/ spaces in the current
2269 <tag/Notes/<itemize>
2270 <item>The function is only available as fastcall function, so it may
2271 only be used in presence of a prototype.
2273 <tag/Availability/cc65
2275 <ref id="cclear" name="cclear">,
2276 <ref id="clrscr" name="clrscr">
2282 <sect1>cgetc<label id="cgetc"><p>
2286 <tag/Function/Read a character from the keyboard.
2287 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2288 <tag/Declaration/<tt/char cgetc (void);/
2289 <tag/Description/The function reads a character from the keyboard. If there is
2290 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2291 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2292 displayed while waiting.
2293 <tag/Notes/<itemize>
2294 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2295 from that buffer; and, wait only if the buffer is empty.
2296 <item>The keyboard must be scanned periodically, in order for this function to
2297 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2299 <tag/Availability/cc65
2301 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2302 <ref id="cursor" name="cursor">,
2303 <ref id="kbhit" name="kbhit">
2309 <sect1>chline<label id="chline"><p>
2313 <tag/Function/Output a horizontal line in text mode.
2314 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2315 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2316 <tag/Description/The function outputs a horizontal line with the given length
2317 starting at the current cursor position.
2318 <tag/Notes/<itemize>
2319 <item>The character used to draw the horizontal line is system dependent.
2320 If available, a line drawing character is used. Drawing a line that is partially
2321 off screen leads to undefined behaviour.
2322 <item>The function is only available as fastcall function, so it may only be
2323 used in presence of a prototype.
2325 <tag/Availability/cc65
2327 <ref id="chlinexy" name="chlinexy">,
2328 <ref id="cvline" name="cvline">,
2329 <ref id="cvlinexy" name="cvlinexy">
2335 <sect1>chlinexy<label id="chlinexy"><p>
2339 <tag/Function/Output a horizontal line at a given position in text mode.
2340 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2341 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2342 <tag/Description/The function outputs a horizontal line with the given length
2343 starting at a given position.
2344 <tag/Notes/<itemize>
2345 <item>The character used to draw the horizontal line is system dependent.
2346 If available, a line drawing character is used. Drawing a line that is partially
2347 off screen leads to undefined behaviour.
2348 <item>The function is only available as fastcall function, so it may only be
2349 used in presence of a prototype.
2351 <tag/Availability/cc65
2353 <ref id="chline" name="chline">,
2354 <ref id="cvline" name="cvline">,
2355 <ref id="cvlinexy" name="cvlinexy">
2361 <sect1>clearerr<label id="clearerr"><p>
2365 <tag/Function/Clear error and end-of-file status of a stream.
2366 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2367 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2368 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2369 indicators for the stream <tt/f/.
2370 <tag/Notes/<itemize>
2371 <item>The function is only available as fastcall function, so it may only be
2372 used in presence of a prototype.
2374 <tag/Availability/ISO 9899
2376 <ref id="feof" name="feof">,
2377 <ref id="ferror" name="ferror">
2383 <sect1>clock<label id="clock"><p>
2387 <tag/Function/Determine the processor time used.
2388 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2389 <tag/Declaration/<tt/clock_t clock (void);/
2390 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2391 time used by the program. The time is returned in implementation-defined
2392 units. It can be converted to seconds by dividing by the value of the macro
2393 <tt/CLOCKS_PER_SEC/.
2394 <tag/Notes/<itemize>
2395 <item>Since the machines that cc65-generated programs run on cannot run multiple
2396 processes, the function actually will return the time since some
2397 implementation-defined point in the past.
2398 <item>The Jiffy clock must be "running", in order for this function to return
2399 changing values. (See the description of <tt/cbm_k_udtim()/.)
2401 <tag/Availability/ISO 9899
2403 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2404 <ref id="time" name="time">
2410 <sect1>clrscr<label id="clrscr"><p>
2414 <tag/Function/Clear the text screen.
2415 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2416 <tag/Declaration/<tt/void clrscr (void);/
2417 <tag/Description/The function clears the text screen and moves the cursor to
2418 the upper left corner.
2419 <tag/Availability/cc65
2421 <ref id="cclear" name="cclear">,
2422 <ref id="cclearxy" name="cclearxy">
2428 <sect1>close<label id="close"><p>
2432 <tag/Function/Close a file descriptor.
2433 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2434 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2435 <tag/Description/The function closes the given file descriptor. It returns zero
2436 on success and -1 on error. If an error occurs, the cause can be determined by
2437 reading the <tt/errno/ variable.
2438 <tag/Notes/<itemize>
2439 <item>The function is only available as fastcall function, so it may only
2440 be used in presence of a prototype.
2442 <tag/Availability/POSIX 1003.1
2444 <ref id="creat" name="creat">,
2445 <ref id="open" name="open">
2451 <sect1>closedir<label id="closedir"><p>
2455 <tag/Function/Close a directory.
2456 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2457 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2458 <tag/Description/The function closes the given directory descriptor. It returns
2459 zero on success and -1 on error. If an error occurs, the cause can be determined
2460 by reading the <tt/errno/ variable.
2461 <tag/Notes/<itemize>
2462 <item>The function is only available as fastcall function, so it may only
2463 be used in presence of a prototype.
2465 <tag/Availability/POSIX 1003.1
2467 <ref id="opendir" name="opendir">,
2468 <ref id="readdir" name="readdir">
2474 <sect1>creat<label id="creat"><p>
2478 <tag/Function/Create a file.
2479 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2480 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2481 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2482 associated with it. On error, -1 is returned and an error code is stored in
2484 <tag/Notes/<itemize>
2485 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2486 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2487 <item>The function is only available as fastcall function, so it may only
2488 be used in presence of a prototype.
2490 <tag/Availability/POSIX 1003.1
2492 <ref id="close" name="close">,
2493 <ref id="open" name="open">
2499 <sect1>cprintf<label id="cprintf"><p>
2503 <tag/Function/Formatted output to the console.
2504 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2505 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2506 <tag/Description/The arguments are converted to text where necessary and
2507 formatted according to the format string given. The resulting string is output
2508 to the console. <tt/cprintf/ supports the same format specifiers as
2509 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2510 <tag/Notes/<itemize>
2511 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2512 between <tt/\r/ and <tt/\n/.
2514 <tag/Availability/cc65
2516 <ref id="cputc" name="cputc">,
2517 <ref id="cputcxy" name="cputcxy">,
2518 <ref id="cputs" name="cputs">,
2519 <ref id="cputsxy" name="cputsxy">,
2520 <ref id="vcprintf" name="vcprintf">
2526 <sect1>cputc<label id="cputc"><p>
2530 <tag/Function/Output a character directly to the console.
2531 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2532 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2533 <tag/Description/Output one character to the console at the current cursor
2535 <tag/Notes/<itemize>
2536 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2537 between <tt/\r/ and <tt/\n/.
2538 <item>The function is only available as fastcall function, so it may only
2539 be used in presence of a prototype.
2541 <tag/Availability/cc65
2543 <ref id="cprintf" name="cprintf">,
2544 <ref id="cputcxy" name="cputcxy">,
2545 <ref id="cputs" name="cputs">,
2546 <ref id="cputsxy" name="cputsxy">,
2547 <ref id="vcprintf" name="vcprintf">
2553 <sect1>cputcxy<label id="cputcxy"><p>
2557 <tag/Function/Output a character at a specific screen position.
2558 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2559 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2560 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2561 the screen and outputs one character.
2562 <tag/Notes/<itemize>
2563 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2564 between <tt/\r/ and <tt/\n/.
2565 <item>The function is only available as fastcall function, so it may only
2566 be used in presence of a prototype.
2568 <tag/Availability/cc65
2570 <ref id="cprintf" name="cprintf">,
2571 <ref id="cputc" name="cputc">,
2572 <ref id="cputs" name="cputs">,
2573 <ref id="cputsxy" name="cputsxy">,
2574 <ref id="vcprintf" name="vcprintf">
2580 <sect1>cputs<label id="cputs"><p>
2584 <tag/Function/Output a string directly to the console.
2585 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2586 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2587 <tag/Description/The function outputs the given string on the console at the
2588 current cursor position.
2589 <tag/Notes/<itemize>
2590 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2591 between <tt/\r/ and <tt/\n/.
2592 <item>The function is only available as fastcall function, so it may only
2593 be used in presence of a prototype.
2595 <tag/Availability/cc65
2597 <ref id="cprintf" name="cprintf">,
2598 <ref id="cputc" name="cputc">,
2599 <ref id="cputcxy" name="cputcxy">,
2600 <ref id="cputsxy" name="cputsxy">,
2601 <ref id="vcprintf" name="vcprintf">
2607 <sect1>cputsxy<label id="cputsxy"><p>
2611 <tag/Function/Output a string to the console at a given position.
2612 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2613 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2614 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2615 and outputs the string <tt/s/.
2616 <tag/Notes/<itemize>
2617 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2618 between <tt/\r/ and <tt/\n/.
2619 <item>The function is only available as fastcall function, so it may only
2620 be used in presence of a prototype.
2622 <tag/Availability/cc65
2624 <ref id="cprintf" name="cprintf">,
2625 <ref id="cputc" name="cputc">,
2626 <ref id="cputcxy" name="cputcxy">,
2627 <ref id="cputs" name="cputs">,
2628 <ref id="vcprintf" name="vcprintf">
2634 <sect1>cursor<label id="cursor"><p>
2638 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2639 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2640 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2641 <tag/Description/If the argument to the function is non zero, a blinking cursor
2642 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2643 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2644 <tag/Notes/<itemize>
2645 <item>The function is only available as fastcall function, so it may only
2646 be used in presence of a prototype.
2648 <tag/Availability/cc65
2650 <ref id="cgetc" name="cgetc">,
2651 <ref id="kbhit" name="kbhit">
2657 <sect1>cvline<label id="cvline"><p>
2661 <tag/Function/Output a vertical line in text mode.
2662 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2663 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2664 <tag/Description/The function outputs a vertical line with the given length
2665 starting at the current cursor position.
2666 <tag/Notes/<itemize>
2667 <item>The character used to draw the vertical line is system dependent.
2668 If available, a line drawing character is used. Drawing a line that is partially
2669 off screen leads to undefined behaviour.
2670 <item>The function is only available as fastcall function, so it may only be
2671 used in presence of a prototype.
2673 <tag/Availability/cc65
2675 <ref id="chline" name="chline">,
2676 <ref id="chlinexy" name="chlinexy">,
2677 <ref id="cvlinexy" name="cvlinexy">
2683 <sect1>cvlinexy<label id="cvlinexy"><p>
2687 <tag/Function/Output a vertical line at a given position in text mode.
2688 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2689 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2690 <tag/Description/The function outputs a vertical line with the given length
2691 starting at a given position.
2692 <tag/Notes/<itemize>
2693 <item>The character used to draw the vertical line is system dependent.
2694 If available, a line drawing character is used. Drawing a line that is partially
2695 off screen leads to undefined behaviour.
2696 <item>The function is only available as fastcall function, so it may only be
2697 used in presence of a prototype.
2699 <tag/Availability/cc65
2701 <ref id="chline" name="chline">,
2702 <ref id="chlinexy" name="chlinexy">,
2703 <ref id="cvline" name="cvline">
2709 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2713 <tag/Function/Uncompress a LZ4-compressed buffer.
2714 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2715 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2716 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2717 <tag/Notes/<itemize>
2718 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2720 <tag/Availability/cc65
2726 <sect1>div<label id="div"><p>
2730 <tag/Function/Divide two ints and return quotient and remainder.
2731 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2732 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2733 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2734 quotient and remainder in a <tt/div_t/ structure.
2735 <tag/Notes/<itemize>
2736 <item>The function is only available as fastcall function, so it may only
2737 be used in presence of a prototype.
2739 <tag/Availability/ISO 9899
2747 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
2751 <tag/Function/Determines whether the screen is going to be cleared after program exit.
2752 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
2753 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
2754 <tag/Description/The function returns zero if the screen won't be cleared immediately after
2755 program termination. It returns a non-zero value if it will.
2756 <tag/Notes/<itemize>
2757 <item>Some systems, maybe depending on configuration, immediately clear the screen
2758 after a program exits. Therefore it might be difficult to read
2759 the last messages printed by the program prior to its exit. This function can be used
2760 to decide if a delay or wait for a key press should be executed when then program
2763 <tag/Availability/cc65
2771 printf("Hello World\n");
2772 if (doesclrscrafterexit())
2781 <sect1>em_commit<label id="em_commit"><p>
2785 <tag/Function/Commit changes into extended memory.
2786 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2787 <tag/Declaration/<tt/void em_commit (void);/
2788 <tag/Description/Commit changes in the memory window to extended storage. If
2789 the contents of the memory window have been changed, these changes may be lost
2790 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
2791 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
2792 name="em_copyto">/ are called without calling <tt/em_commit/ first.
2793 <tag/Notes/<itemize>
2794 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
2795 memory window are discarded, it does just mean that the drivers is allowed
2797 <item>The function is only available as fastcall function, so it may only be
2798 used in presence of a prototype.
2799 <item>The function produces undefined results if no extended memory driver is
2802 <tag/Availability/cc65
2804 <ref id="em_load_driver" name="em_load_driver">,
2805 <ref id="em_map" name="em_map">,
2806 <ref id="em_use" name="em_use">
2812 <sect1>em_copyfrom<label id="em_copyfrom"><p>
2816 <tag/Function/Copy from extended into normal memory.
2817 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2818 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
2819 <tag/Description/Copy data from extended memory into linear memory. Source and
2820 target addresses as well as the number of bytes to transfer are specified in
2821 the <tt/em_copy/ structure that is passed as a parameter.
2822 <tag/Notes/<itemize>
2823 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
2824 made any changes to the data in the window, call <tt/<ref id="em_commit"
2825 name="em_commit">/ first, or the changes are lost.
2826 <item>The function is only available as fastcall function, so it may only be
2827 used in presence of a prototype.
2828 <item>The function produces undefined results if no extended memory driver is
2831 <tag/Availability/cc65
2833 <ref id="em_commit" name="em_commit">,
2834 <ref id="em_copyto" name="em_copyto">,
2835 <ref id="em_load_driver" name="em_load_driver">
2841 <sect1>em_copyto<label id="em_copyto"><p>
2845 <tag/Function/Copy from normal into extended memory.
2846 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2847 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
2848 <tag/Description/Copy data from linear into extended memory. Source and
2849 target addresses as well as the number of bytes to transfer are specified in
2850 the <tt/em_copy/ structure that is passed as a parameter.
2851 <tag/Notes/<itemize>
2852 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
2853 made any changes to the data in the window, call <tt/<ref id="em_commit"
2854 name="em_commit">/ first, or the changes are lost.
2855 <item>The function is only available as fastcall function, so it may only be
2856 used in presence of a prototype.
2857 <item>The function produces undefined results if no extended memory driver is
2860 <tag/Availability/cc65
2862 <ref id="em_commit" name="em_commit">,
2863 <ref id="em_copyfrom" name="em_copyfrom">,
2864 <ref id="em_load_driver" name="em_load_driver">
2870 <sect1>em_install<label id="em_install"><p>
2874 <tag/Function/Install an already loaded extended memory driver.
2875 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2876 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
2877 <tag/Description/The function installs an already loaded extended memory driver
2878 and returns an error code. The function may be used to install a driver linked
2879 statically to the program.
2880 <tag/Notes/<itemize>
2881 <item>Not all drivers are able to detect if the supported hardware is really
2883 <item>The function is only available as fastcall function, so it may only be
2884 used in presence of a prototype.
2886 <tag/Availability/cc65
2888 <ref id="em_load_driver" name="em_load_driver">,
2889 <ref id="em_uninstall" name="em_uninstall">,
2890 <ref id="em_unload" name="em_unload">
2896 <sect1>em_load_driver<label id="em_load_driver"><p>
2900 <tag/Function/Load and initialize an extended memory driver.
2901 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2902 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
2903 <tag/Description/Load an extended memory driver into memory and initialize
2904 it. The function returns an error code that tells if all this has been
2906 <tag/Notes/<itemize>
2907 <item>Not all drivers are able to detect if the supported hardware is really
2909 <item>The function is only available as fastcall function, so it may only be
2910 used in presence of a prototype.
2911 <item>The driver is loaded by name, so currently you must know the type of
2912 extended memory that should be supported. There is no autodetect capability.
2914 <tag/Availability/cc65
2916 <ref id="em_unload" name="em_unload">
2922 <sect1>em_map<label id="em_map"><p>
2926 <tag/Function/Make a page of extended memory accessible.
2927 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2928 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
2929 <tag/Description/The function maps one page of extended memory into linear
2930 memory and returns a pointer to the page frame. Depending on the hardware
2931 and driver, the data is either mapped into the address space or transfered
2932 into a buffer. If you don't need the actual contents of the page (for example
2933 because you're going to overwrite it completely), it is better to call
2934 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
2935 data if it is possible to avoid that.
2936 <tag/Notes/<itemize>
2937 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
2938 made any changes to the data in the window, call <tt/<ref id="em_commit"
2939 name="em_commit">/ first, or the changes are lost.
2940 <item>The function is only available as fastcall function, so it may only be
2941 used in presence of a prototype.
2942 <item>The function produces undefined results if no extended memory driver is
2945 <tag/Availability/cc65
2947 <ref id="em_commit" name="em_commit">,
2948 <ref id="em_load_driver" name="em_load_driver">,
2949 <ref id="em_use" name="em_use">
2955 <sect1>em_pagecount<label id="em_pagecount"><p>
2959 <tag/Function/Return the number of available extended memory pages.
2960 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2961 <tag/Declaration/<tt/unsigned em_pagecount (void);/
2962 <tag/Description/The function returns the size of the extended memory supported
2963 by the driver in 256 byte pages.
2964 <tag/Notes/<itemize>
2965 <item>The function returns zero if no extended memory driver is loaded.
2966 <item>The function may return zero if the supported hardware was not detected.
2968 <tag/Availability/cc65
2970 <ref id="em_load_driver" name="em_load_driver">
2976 <sect1>em_uninstall<label id="em_uninstall"><p>
2980 <tag/Function/Uninstall an already loaded extended memory driver.
2981 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2982 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
2983 <tag/Description/The function uninstalls an already loaded extended memory
2984 driver but doesn't remove it from memory.
2985 <tag/Notes/<itemize>
2986 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
2987 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
2988 should be used instead of <tt/em_uninstall/ so the driver is also removed
2991 <tag/Availability/cc65
2993 <ref id="em_install" name="em_install">,
2994 <ref id="em_load_driver" name="em_load_driver">,
2995 <ref id="em_unload" name="em_unload">
3001 <sect1>em_unload<label id="em_unload"><p>
3005 <tag/Function/Unload an extended memory driver.
3006 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3007 <tag/Declaration/<tt/unsigned char em_unload (void);/
3008 <tag/Description/The function unloads a loaded extended memory driver and
3009 frees all memory allocated for the driver.
3010 <tag/Notes/<itemize>
3011 <item>The function does nothing if no driver is loaded.
3013 <tag/Availability/cc65
3015 <ref id="em_load_driver" name="em_load_driver">
3021 <sect1>em_use<label id="em_use"><p>
3025 <tag/Function/Prepare an extended memory page for use.
3026 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3027 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3028 <tag/Description/The function maps one page of extended memory into linear
3029 memory and returns a pointer to the page frame. This function is similar to
3030 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3031 actual memory window in the assumption that the existing data is wrong or
3032 will get overwritten.
3033 <tag/Notes/<itemize>
3034 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3035 made any changes to the data in the window, call <tt/<ref id="em_commit"
3036 name="em_commit">/ first, or the changes are lost.
3037 <item>The function is only available as fastcall function, so it may only be
3038 used in presence of a prototype.
3039 <item>The function produces undefined results if no extended memory driver is
3042 <tag/Availability/cc65
3044 <ref id="em_commit" name="em_commit">,
3045 <ref id="em_load_driver" name="em_load_driver">,
3046 <ref id="em_map" name="em_map">
3052 <sect1>exit<label id="exit"><p>
3056 <tag/Function/Terminate the program.
3057 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3058 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3059 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3060 return code of the program. Before termination, all files are closed, buffered
3061 output is written and any functions registered with <tt/<ref id="atexit"
3062 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3063 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3065 <tag/Notes/<itemize>
3066 <item>The function is only available as fastcall function, so it may only
3067 be used in presence of a prototype.
3068 <item>It depends on the host machine if the program return code can be
3069 evaluated or is ignored.
3071 <tag/Availability/ISO 9899
3073 <ref id="abort" name="abort">,
3074 <ref id="exit" name="exit">
3080 <sect1>exec<label id="exec"><p>
3084 <tag/Function/Execute a program file.
3085 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3086 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3087 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3088 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3089 then loading and starting the program named in the first argument, passing
3090 the command line specified as second argument. Instead of an empty string,
3091 a <tt/NULL/ pointer may be passed as second parameter.
3092 On success, the function does not return. On failure, -1 is returned and
3093 <tt/errno/ contains an error code.
3094 <tag/Notes/<itemize>
3095 <item>The function is only available as fastcall function, so it may only
3096 be used in presence of a prototype.
3097 <item>On most platforms, the function needs to copy a small stub loader to
3098 some memory area outside the program space. This may collide with other
3099 programs. See the platform specific docs on this.
3100 <item>Because it is necessary to terminate the running program before the
3101 memory can be reused to load the new one, there is a high chance that the
3102 function may not be able to return on errors.
3103 <item>The command line is passed to the new program in the same way as cc65
3104 programs expect the command line. If the new program is not a cc65 generated
3105 program, it may not be able to read it.
3107 <tag/Availability/cc65
3109 <ref id="exit" name="exit">
3115 <sect1>fast<label id="fast"><p>
3119 <tag/Function/Switch the C128 into 2MHz mode.
3120 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3121 <tag/Declaration/<tt/void fast (void);/
3122 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
3123 will nearly double the speed compared to slow mode.
3124 <tag/Notes/<itemize>
3125 <item>The function is specific to the C128.
3126 <item>2MHz clock will not work in 40 column mode.
3128 <tag/Availability/C128
3130 <ref id="slow" name="slow">,
3131 <ref id="toggle_videomode" name="toggle_videomode">,
3132 <ref id="videomode" name="videomode">
3138 <sect1>feof<label id="feof"><p>
3142 <tag/Function/Return the end-of-file indicator of a stream.
3143 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3144 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3145 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3146 <tt/f/, and returns a non zero value if it is set.
3147 <tag/Notes/<itemize>
3148 <item>The indicator is set only after a read past the end of a file is
3150 <item>The function is only available as fastcall function, so it may only be
3151 used in presence of a prototype.
3153 <tag/Availability/ISO 9899
3155 <ref id="feof" name="clearerr">,
3156 <ref id="ferror" name="ferror">
3162 <sect1>ferror<label id="ferror"><p>
3166 <tag/Function/Return the error indicator of a stream.
3167 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3168 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3169 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3170 <tt/f/, and returns a non zero value if it is set.
3171 <tag/Notes/<itemize>
3172 <item>The function is only available as fastcall function, so it may only be
3173 used in presence of a prototype.
3175 <tag/Availability/ISO 9899
3177 <ref id="feof" name="clearerr">,
3178 <ref id="ferror" name="feof">
3184 <sect1>fileno<label id="fileno"><p>
3188 <tag/Function/Return the file handle used by a stream.
3189 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3190 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3191 <tag/Description/The <tt/fileno/ function returns the file handle used
3192 internally by a C stream. This file handle (an integer) can be used as a
3193 handle for the POSIX input/output functions.
3194 <tag/Notes/<itemize>
3195 <item>The function is only available as fastcall function, so it may only be
3196 used in presence of a prototype.
3197 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3198 file may have unpredictable results.
3200 <tag/Availability/POSIX 1003.1
3202 <ref id="creat" name="creat">,
3203 <ref id="open" name="open"> <!-- , -->
3204 <!-- <ref id="read" name="read">, -->
3205 <!-- <ref id="write" name="write"> -->
3211 <sect1>free<label id="free"><p>
3215 <tag/Function/Free a block of dynamic memory.
3216 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3217 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3218 <tag/Description/Free a block of dynamic memory previously allocated with
3219 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3220 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3221 pointer is <tt/NULL/, no action is performed.
3222 <tag/Notes/<itemize>
3223 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3224 behaviour and may crash your program.
3225 <item>The function is only available as fastcall function, so it may only
3226 be used in presence of a prototype.
3228 <tag/Availability/ISO 9899
3230 <ref id="_heapadd" name="_heapadd">,
3231 <ref id="_heapblocksize" name="_heapblocksize">,
3232 <ref id="_heapmaxavail" name="_heapmaxavail">,
3233 <ref id="_heapmemavail" name="_heapmemavail">,
3234 <ref id="calloc" name="calloc">,
3235 <ref id="malloc" name="malloc">,
3236 <ref id="realloc" name="realloc">
3242 <sect1>get_ostype<label id="get_ostype"><p>
3246 <tag/Function/The function returns the operating system, the program runs on.
3247 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3248 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3249 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3250 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3251 all supported targets. If it exists, it returns a number that identifies the
3252 operating system or machine type, the program runs on. The machine dependent
3253 header files define constants that can be used to check the return code.
3254 <tag/Notes/<itemize>
3255 <item>The function does not exist on all platforms.
3256 <item>The return codes are platform dependent.
3258 <tag/Availability/cc65 (not all platforms)
3264 <sect1>getcpu<label id="getcpu"><p>
3268 <tag/Function/Determine on which CPU the program is running.
3269 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3270 <tag/Declaration/<tt/unsigned char getcpu (void);/
3271 <tag/Description/The function checks on which CPU the code is running. It
3272 returns one of the constants<itemize>
3274 <item><tt/CPU_65C02/
3275 <item><tt/CPU_65816/
3277 <tag/Notes/<itemize>
3278 <item>Other, more exotic CPU types are not disinguished.
3280 <tag/Availability/cc65
3286 <sect1>getenv<label id="getenv"><p>
3290 <tag/Function/Return a value from the environment.
3291 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3292 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3293 <tag/Description/The function searches the environment for an entry that
3294 matches <tt/name/ and returns its value. The environment consists of a list
3295 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3297 <tag/Notes/<itemize>
3298 <item>What exactly is stored in the environment depends on the machine the
3299 program is running on.
3300 <item>The function is only available as fastcall function, so it may only
3301 be used in presence of a prototype.
3303 <tag/Availability/ISO 9899
3309 <sect1>getopt<label id="getopt"><p>
3313 <tag/Function/Parse command line options.
3314 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3315 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3316 const char* optstring);/
3317 <tag/Description/The function parses command line arguments, <tt/argc/ and
3318 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3319 is a string that contains command line option characters. If a character in
3320 <tt/optstring/ is followed by a colon, the option requires an argument. An
3321 option on the command line is recognized if it is one of the option characters
3323 <tt/getopt/ must be called repeatedly. It will return each option character
3324 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3325 option argument is placed in <tt/optarg/, the index of the next element on the
3326 command line to be processed is placed in <tt/optind/.
3327 <tag/Notes/<itemize>
3328 <item>The implementation will not reorder options. A non option on the command
3329 line will terminate option processing. All remaining arguments are not
3330 recognized as options, even if the start with a '-' character.
3331 <item>The function is only available as fastcall function, so it may only
3332 be used in presence of a prototype.
3334 <tag/Availability/POSIX.2
3340 <sect1>gotox<label id="gotox"><p>
3344 <tag/Function/Move the text mode cursor to a new X position.
3345 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3346 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3347 <tag/Description/The function moves the text mode cursor to the specified X
3348 position while leaving the Y position untouched. The leftmost position on the
3349 screen has the coordinate 0.
3350 <tag/Notes/<itemize>
3351 <item>The function is only available as fastcall function, so it may
3352 only be used in presence of a prototype.
3353 <item>Invalid values for the X position (out of screen coordinates) may
3354 lead to undefined behaviour.
3356 <tag/Availability/cc65
3358 <ref id="gotoy" name="gotoy">,
3359 <ref id="gotoxy" name="gotoxy">,
3360 <ref id="wherex" name="wherex">,
3361 <ref id="wherey" name="wherey">
3367 <sect1>gotoxy<label id="gotoxy"><p>
3371 <tag/Function/Move the text mode cursor to a new position.
3372 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3373 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3374 <tag/Description/The function moves the text mode cursor to the specified
3375 position. The leftmost position on the screen has the X coordinate 0, the
3376 topmost line has the Y coordinate 0.
3377 <tag/Notes/<itemize>
3378 <item>The function is only available as fastcall function, so it may only be
3379 used in presence of a prototype.
3380 <item>Invalid values for any of both coordinates (out of screen positions) may
3381 lead to undefined behaviour.
3383 <tag/Availability/cc65
3385 <ref id="gotox" name="gotox">,
3386 <ref id="gotoy" name="gotoy">,
3387 <ref id="wherex" name="wherex">,
3388 <ref id="wherey" name="wherey">
3394 <sect1>gotoy<label id="gotoy"><p>
3398 <tag/Function/Move the text mode cursor to a new Y position.
3399 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3400 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3401 <tag/Description/The function moves the text mode cursor to the specified Y
3402 position while leaving the X position untouched. The uppermost position on the
3403 screen has the coordinate 0.
3404 <tag/Notes/<itemize>
3405 <item>The function is only available as fastcall function, so it may
3406 only be used in presence of a prototype.
3407 <item>Invalid values for the Y position (out of screen coordinates) may lead
3408 to undefined behaviour.
3410 <tag/Availability/cc65
3412 <ref id="gotox" name="gotox">,
3413 <ref id="gotoxy" name="gotoxy">,
3414 <ref id="wherex" name="wherex">,
3415 <ref id="wherey" name="wherey">
3421 <sect1>isalnum<label id="isalnum"><p>
3425 <tag/Function/Check if a given character is a letter or digit.
3426 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3427 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3428 <tag/Description/The function returns a non zero value if the given argument
3429 is a letter or digit. The return value is zero if the character is anything
3431 <tag/Notes/<itemize>
3432 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3433 inline sequence generated by the macro will not work correctly for values
3434 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3435 this range. The non inline function may be accessed by <tt/#undef/'ing
3437 <item>When compiling without <tt/-Os/, the function is only available as
3438 fastcall function, so it may only be used in presence of a prototype.
3440 <tag/Availability/ISO 9899
3442 <ref id="isalpha" name="isalpha">,
3443 <ref id="isascii" name="isascii">,
3444 <ref id="isblank" name="isblank">,
3445 <ref id="iscntrl" name="iscntrl">,
3446 <ref id="isdigit" name="isdigit">,
3447 <ref id="isgraph" name="isgraph">,
3448 <ref id="islower" name="islower">,
3449 <ref id="isprint" name="isprint">,
3450 <ref id="ispunct" name="ispunct">,
3451 <ref id="isspace" name="isspace">,
3452 <ref id="isupper" name="isupper">,
3453 <ref id="isxdigit" name="isxdigit">
3459 <sect1>isalpha<label id="isalpha"><p>
3463 <tag/Function/Check if a given character is a letter.
3464 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3465 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3466 <tag/Description/The function returns a non zero value if the given argument
3467 is a letter. The return value is zero if the character is anything else.
3468 <tag/Notes/<itemize>
3469 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3470 inline sequence generated by the macro will not work correctly for values
3471 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3472 this range. The non inline function may be accessed by <tt/#undef/'ing the
3474 <item>When compiling without <tt/-Os/, the function is only available as
3475 fastcall function, so it may only be used in presence of a prototype.
3477 <tag/Availability/ISO 9899
3479 <ref id="isalnum" name="isalnum">,
3480 <ref id="isascii" name="isascii">,
3481 <ref id="isblank" name="isblank">,
3482 <ref id="iscntrl" name="iscntrl">,
3483 <ref id="isdigit" name="isdigit">,
3484 <ref id="isgraph" name="isgraph">,
3485 <ref id="islower" name="islower">,
3486 <ref id="isprint" name="isprint">,
3487 <ref id="ispunct" name="ispunct">,
3488 <ref id="isspace" name="isspace">,
3489 <ref id="isupper" name="isupper">,
3490 <ref id="isxdigit" name="isxdigit">
3496 <sect1>isascii<label id="isascii"><p>
3500 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3501 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3502 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3503 <tag/Description/The function returns a non zero value if the given argument
3504 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3505 <tag/Notes/<itemize>
3506 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3507 inline sequence generated by the macro will not work correctly for values
3508 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3509 this range. The non inline function may be accessed by <tt/#undef/'ing the
3511 <item>When compiling without <tt/-Os/, the function is only available as
3512 fastcall function, so it may only be used in presence of a prototype.
3514 <tag/Availability/ISO 9899
3516 <ref id="isalnum" name="isalnum">,
3517 <ref id="isalpha" name="isalpha">,
3518 <ref id="isblank" name="isblank">,
3519 <ref id="iscntrl" name="iscntrl">,
3520 <ref id="isdigit" name="isdigit">,
3521 <ref id="isgraph" name="isgraph">,
3522 <ref id="islower" name="islower">,
3523 <ref id="isprint" name="isprint">,
3524 <ref id="ispunct" name="ispunct">,
3525 <ref id="isspace" name="isspace">,
3526 <ref id="isupper" name="isupper">,
3527 <ref id="isxdigit" name="isxdigit">
3533 <sect1>isblank<label id="isblank"><p>
3537 <tag/Function/Check if a given character is a space or tab.
3538 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3539 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3540 <tag/Description/The function returns a non zero value if the given argument
3541 is a space or tab character. The return value is zero if the character is
3543 <tag/Notes/<itemize>
3544 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3545 inline sequence generated by the macro will not work correctly for values
3546 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3547 this range. The non inline function may be accessed by <tt/#undef/'ing the
3549 <item>When compiling without <tt/-Os/, the function is only available as
3550 fastcall function, so it may only be used in presence of a prototype.
3552 <tag/Availability/ISO 9899
3554 <ref id="isalnum" name="isalnum">,
3555 <ref id="isalpha" name="isalpha">,
3556 <ref id="isascii" name="isascii">,
3557 <ref id="iscntrl" name="iscntrl">,
3558 <ref id="isdigit" name="isdigit">,
3559 <ref id="isgraph" name="isgraph">,
3560 <ref id="islower" name="islower">,
3561 <ref id="isprint" name="isprint">,
3562 <ref id="ispunct" name="ispunct">,
3563 <ref id="isspace" name="isspace">,
3564 <ref id="isupper" name="isupper">,
3565 <ref id="isxdigit" name="isxdigit">
3571 <sect1>iscntrl<label id="iscntrl"><p>
3575 <tag/Function/Check if a given character is a control character.
3576 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3577 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3578 <tag/Description/The function returns a non zero value if the given argument
3579 is a control character. The return value is zero if the character is anything
3581 <tag/Notes/<itemize>
3582 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3583 inline sequence generated by the macro will not work correctly for values
3584 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3585 this range. The non inline function may be accessed by <tt/#undef/'ing the
3587 <item>When compiling without <tt/-Os/, the function is only available as
3588 fastcall function, so it may only be used in presence of a prototype.
3590 <tag/Availability/ISO 9899
3592 <ref id="isalnum" name="isalnum">,
3593 <ref id="isalpha" name="isalpha">,
3594 <ref id="isascii" name="isascii">,
3595 <ref id="isblank" name="isblank">,
3596 <ref id="isdigit" name="isdigit">,
3597 <ref id="isgraph" name="isgraph">,
3598 <ref id="islower" name="islower">,
3599 <ref id="isprint" name="isprint">,
3600 <ref id="ispunct" name="ispunct">,
3601 <ref id="isspace" name="isspace">,
3602 <ref id="isupper" name="isupper">,
3603 <ref id="isxdigit" name="isxdigit">
3609 <sect1>isdigit<label id="isdigit"><p>
3613 <tag/Function/Check if a given character is a digit.
3614 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3615 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
3616 <tag/Description/The function returns a non zero value if the given argument
3617 is a digit. The return value is zero if the character is anything else.
3618 <tag/Notes/<itemize>
3619 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3620 inline sequence generated by the macro will not work correctly for values
3621 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3622 this range. The non inline function may be accessed by <tt/#undef/'ing the
3624 <item>When compiling without <tt/-Os/, the function is only available as
3625 fastcall function, so it may only be used in presence of a prototype.
3627 <tag/Availability/ISO 9899
3629 <ref id="isalnum" name="isalnum">,
3630 <ref id="isalpha" name="isalpha">,
3631 <ref id="isascii" name="isascii">,
3632 <ref id="isblank" name="isblank">,
3633 <ref id="iscntrl" name="iscntrl">,
3634 <ref id="isgraph" name="isgraph">,
3635 <ref id="islower" name="islower">,
3636 <ref id="isprint" name="isprint">,
3637 <ref id="ispunct" name="ispunct">,
3638 <ref id="isspace" name="isspace">,
3639 <ref id="isupper" name="isupper">,
3640 <ref id="isxdigit" name="isxdigit">
3646 <sect1>isgraph<label id="isgraph"><p>
3650 <tag/Function/Check if a given character is a printable character (except
3652 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3653 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
3654 <tag/Description/The function returns a non zero value if the given argument
3655 is a printable character with the exception of space. The return value is zero
3656 if the character is anything else.
3657 <tag/Notes/<itemize>
3658 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3659 inline sequence generated by the macro will not work correctly for values
3660 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3661 this range. The non inline function may be accessed by <tt/#undef/'ing the
3663 <item>When compiling without <tt/-Os/, the function is only available as
3664 fastcall function, so it may only be used in presence of a prototype.
3666 <tag/Availability/ISO 9899
3668 <ref id="isalnum" name="isalnum">,
3669 <ref id="isalpha" name="isalpha">,
3670 <ref id="isascii" name="isascii">,
3671 <ref id="isblank" name="isblank">,
3672 <ref id="iscntrl" name="iscntrl">,
3673 <ref id="isdigit" name="isdigit">,
3674 <ref id="islower" name="islower">,
3675 <ref id="isprint" name="isprint">,
3676 <ref id="ispunct" name="ispunct">,
3677 <ref id="isspace" name="isspace">,
3678 <ref id="isupper" name="isupper">,
3679 <ref id="isxdigit" name="isxdigit">
3685 <sect1>islower<label id="islower"><p>
3689 <tag/Function/Check if a given character is a lower case letter.
3690 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3691 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
3692 <tag/Description/The function returns a non zero value if the given argument
3693 is a lower case letter. The return value is zero if the character is anything
3695 <tag/Notes/<itemize>
3696 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3697 inline sequence generated by the macro will not work correctly for values
3698 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3699 this range. The non inline function may be accessed by <tt/#undef/'ing the
3701 <item>When compiling without <tt/-Os/, the function is only available as
3702 fastcall function, so it may only be used in presence of a prototype.
3704 <tag/Availability/ISO 9899
3706 <ref id="isalnum" name="isalnum">,
3707 <ref id="isalpha" name="isalpha">,
3708 <ref id="isascii" name="isascii">,
3709 <ref id="isblank" name="isblank">,
3710 <ref id="iscntrl" name="iscntrl">,
3711 <ref id="isdigit" name="isdigit">,
3712 <ref id="isgraph" name="isgraph">,
3713 <ref id="isprint" name="isprint">,
3714 <ref id="ispunct" name="ispunct">,
3715 <ref id="isspace" name="isspace">,
3716 <ref id="isupper" name="isupper">,
3717 <ref id="isxdigit" name="isxdigit">
3723 <sect1>isprint<label id="isprint"><p>
3727 <tag/Function/Check if a given character is a printable character.
3728 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3729 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
3730 <tag/Description/The function returns a non zero value if the given argument
3731 is a printable character (this includes the space character). The return value
3732 is zero if the character is anything else.
3733 <tag/Notes/<itemize>
3734 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3735 inline sequence generated by the macro will not work correctly for values
3736 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3737 this range. The non inline function may be accessed by <tt/#undef/'ing the
3739 <item>When compiling without <tt/-Os/, the function is only available as
3740 fastcall function, so it may only be used in presence of a prototype.
3742 <tag/Availability/ISO 9899
3744 <ref id="isalnum" name="isalnum">,
3745 <ref id="isalpha" name="isalpha">,
3746 <ref id="isascii" name="isascii">,
3747 <ref id="isblank" name="isblank">,
3748 <ref id="iscntrl" name="iscntrl">,
3749 <ref id="isdigit" name="isdigit">,
3750 <ref id="isgraph" name="isgraph">,
3751 <ref id="islower" name="islower">,
3752 <ref id="ispunct" name="ispunct">,
3753 <ref id="isspace" name="isspace">,
3754 <ref id="isupper" name="isupper">,
3755 <ref id="isxdigit" name="isxdigit">
3761 <sect1>ispunct<label id="ispunct"><p>
3765 <tag/Function/Check if a given character is a printable character but not a
3766 space or an alphanumeric character.
3767 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3768 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
3769 <tag/Description/The function returns a non zero value if the given argument
3770 is a printable character, but not a space or anything alphanumeric. The return
3771 value is zero if the character is anything else.
3772 <tag/Notes/<itemize>
3773 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3774 inline sequence generated by the macro will not work correctly for values
3775 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3776 this range. The non inline function may be accessed by <tt/#undef/'ing the
3778 <item>When compiling without <tt/-Os/, the function is only available as
3779 fastcall function, so it may only be used in presence of a prototype.
3781 <tag/Availability/ISO 9899
3783 <ref id="isalnum" name="isalnum">,
3784 <ref id="isalpha" name="isalpha">,
3785 <ref id="isascii" name="isascii">,
3786 <ref id="isblank" name="isblank">,
3787 <ref id="iscntrl" name="iscntrl">,
3788 <ref id="isdigit" name="isdigit">,
3789 <ref id="isgraph" name="isgraph">,
3790 <ref id="islower" name="islower">,
3791 <ref id="isprint" name="isprint">,
3792 <ref id="isspace" name="isspace">,
3793 <ref id="isupper" name="isupper">,
3794 <ref id="isxdigit" name="isxdigit">
3800 <sect1>isspace<label id="isspace"><p>
3804 <tag/Function/Check if a given character is a white-space character.
3805 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3806 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
3807 <tag/Description/The function returns a non zero value if the given argument
3808 is a white space character. The return value is zero if the character is
3809 anything else. The standard white space characters are: space, formfeed ('\f'),
3810 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
3812 <tag/Notes/<itemize>
3813 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3814 inline sequence generated by the macro will not work correctly for values
3815 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3816 this range. The non inline function may be accessed by <tt/#undef/'ing the
3818 <item>When compiling without <tt/-Os/, the function is only available as
3819 fastcall function, so it may only be used in presence of a prototype.
3821 <tag/Availability/ISO 9899
3823 <ref id="isalnum" name="isalnum">,
3824 <ref id="isalpha" name="isalpha">,
3825 <ref id="isascii" name="isascii">,
3826 <ref id="isblank" name="isblank">,
3827 <ref id="iscntrl" name="iscntrl">,
3828 <ref id="isdigit" name="isdigit">,
3829 <ref id="isgraph" name="isgraph">,
3830 <ref id="islower" name="islower">,
3831 <ref id="isprint" name="isprint">,
3832 <ref id="ispunct" name="ispunct">,
3833 <ref id="isupper" name="isupper">,
3834 <ref id="isxdigit" name="isxdigit">
3840 <sect1>isupper<label id="isupper"><p>
3844 <tag/Function/Check if a given character is an upper case letter.
3845 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3846 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
3847 <tag/Description/The function returns a non zero value if the given argument
3848 is an upper case letter. The return value is zero if the character is anything
3850 <tag/Notes/<itemize>
3851 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3852 inline sequence generated by the macro will not work correctly for values
3853 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3854 this range. The non inline function may be accessed by <tt/#undef/'ing the
3856 <item>When compiling without <tt/-Os/, the function is only available as
3857 fastcall function, so it may only be used in presence of a prototype.
3859 <tag/Availability/ISO 9899
3861 <ref id="isalnum" name="isalnum">,
3862 <ref id="isalpha" name="isalpha">,
3863 <ref id="isascii" name="isascii">,
3864 <ref id="isblank" name="isblank">,
3865 <ref id="iscntrl" name="iscntrl">,
3866 <ref id="isdigit" name="isdigit">,
3867 <ref id="isgraph" name="isgraph">,
3868 <ref id="islower" name="islower">,
3869 <ref id="isprint" name="isprint">,
3870 <ref id="ispunct" name="ispunct">,
3871 <ref id="isspace" name="isspace">,
3872 <ref id="isxdigit" name="isxdigit">
3878 <sect1>isxdigit<label id="isxdigit"><p>
3882 <tag/Function/Check if a given character is a hexadecimal digit.
3883 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3884 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
3885 <tag/Description/The function returns a non zero value if the given argument
3886 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
3887 character is anything else.
3888 <tag/Notes/<itemize>
3889 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3890 inline sequence generated by the macro will not work correctly for values
3891 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3892 this range. The non inline function may be accessed by <tt/#undef/'ing the
3894 <item>When compiling without <tt/-Os/, the function is only available as
3895 fastcall function, so it may only be used in presence of a prototype.
3897 <tag/Availability/ISO 9899
3899 <ref id="isalnum" name="isalnum">,
3900 <ref id="isalpha" name="isalpha">,
3901 <ref id="isascii" name="isascii">,
3902 <ref id="isblank" name="isblank">,
3903 <ref id="iscntrl" name="iscntrl">,
3904 <ref id="isdigit" name="isdigit">,
3905 <ref id="isgraph" name="isgraph">,
3906 <ref id="islower" name="islower">,
3907 <ref id="isprint" name="isprint">,
3908 <ref id="ispunct" name="ispunct">,
3909 <ref id="isspace" name="isspace">,
3910 <ref id="isupper" name="isupper">
3916 <sect1>itoa<label id="itoa"><p>
3920 <tag/Function/Convert an integer into a string.
3921 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3922 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
3923 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
3924 <tt/radix/ as the base.
3925 <tag/Notes/<itemize>
3926 <item>There are no provisions to prevent a buffer overflow.
3927 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
3928 <item>The function is non standard, so it is not available in strict ANSI mode.
3929 You should probably use <tt/sprintf/ instead.
3930 <item>The function is only available as fastcall function, so it may only be
3931 used in presence of a prototype.
3933 <tag/Availability/cc65
3935 <ref id="atoi" name="atoi">,
3936 <ref id="atol" name="atol">,
3937 <ref id="ltoa" name="ltoa">,
3938 <ref id="ultoa" name="ultoa">,
3939 <ref id="utoa" name="utoa">
3945 <sect1>joy_count<label id="joy_count"><p>
3949 <tag/Function/Return the number of joysticks supported by the current driver.
3950 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3951 <tag/Declaration/<tt/unsigned char joy_count (void);/
3952 <tag/Description/The function returns a the number of joysticks supported
3953 by the current joystick driver.
3954 <tag/Notes/<itemize>
3955 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3956 name="joy_load_driver"> before calling this function.
3957 <item>The function returns the number of joysticks supported by the driver.
3958 There's no way to check for the number of actually connected joysticks.
3960 <tag/Availability/cc65
3962 <ref id="joy_load_driver" name="joy_load_driver">,
3963 <ref id="joy_read" name="joy_read">
3969 <sect1>joy_install<label id="joy_install"><p>
3973 <tag/Function/Install an already loaded driver and return an error code.
3974 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3975 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
3976 <tag/Description/The function installs a driver that was already loaded into
3977 memory (or linked statically to the program). It returns an error code
3978 (<tt/JOY_ERR_OK/ in case of success).
3979 <tag/Notes/<itemize>
3980 <item>The function is only available as fastcall function, so it may only be
3981 used in presence of a prototype.
3983 <tag/Availability/cc65
3985 <ref id="joy_load_driver" name="joy_load_driver">,
3986 <ref id="joy_uninstall" name="joy_uninstall">,
3987 <ref id="joy_unload" name="joy_unload">
3993 <sect1>joy_load_driver<label id="joy_load_driver"><p>
3997 <tag/Function/Load a driver from disk and install it.
3998 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3999 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4000 <tag/Description/The function loads a driver with the given name from disk
4001 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4002 driver was successfully loaded and installed.
4003 <tag/Notes/<itemize>
4004 <item>The function is only available as fastcall function, so it may only be
4005 used in presence of a prototype.
4007 <tag/Availability/cc65
4009 <ref id="joy_install" name="joy_install">,
4010 <ref id="joy_uninstall" name="joy_uninstall">,
4011 <ref id="joy_unload" name="joy_unload">
4017 <sect1>joy_read<label id="joy_read"><p>
4021 <tag/Function/Read the status of a joystick.
4022 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4023 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4024 <tag/Description/The function reads the status bits for a joystick. The number
4025 of the joystick is passed as parameter. The result may be examined by using one
4026 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4027 <tag/Notes/<itemize>
4028 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4029 name="joy_load_driver"> before calling this function.
4030 <item>The function is only available as fastcall function, so it may only be
4031 used in presence of a prototype.
4033 <tag/Availability/cc65
4035 <ref id="joy_count" name="joy_count">,
4036 <ref id="joy_load_driver" name="joy_load_driver">,
4037 <ref id="joy_unload" name="joy_unload">
4043 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4047 <tag/Function/Uninstall the current joystick driver.
4048 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4049 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4050 <tag/Description/The function uninstalls the currently installed joystick
4051 driver. It does not remove the driver from memory. The function returns an
4052 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4053 <tag/Notes/<itemize>
4054 <item>A joystick driver must be installed using <ref id="joy_install"
4055 name="joy_install"> before calling this function.
4057 <tag/Availability/cc65
4059 <ref id="joy_install" name="joy_install">,
4060 <ref id="joy_load_driver" name="joy_load_driver">,
4061 <ref id="joy_unload" name="joy_unload">
4067 <sect1>joy_unload<label id="joy_unload"><p>
4071 <tag/Function/Uninstall, then unload the current joystick driver.
4072 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4073 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4074 <tag/Description/The function uninstalls the currently installed joystick
4075 driver and removes it from memory. An error code is returned, which is
4076 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4077 <tag/Notes/<itemize>
4078 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4079 name="joy_load_driver"> before calling this function.
4081 <tag/Availability/cc65
4083 <ref id="joy_load_driver" name="joy_load_driver">
4089 <sect1>kbhit<label id="kbhit"><p>
4093 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4094 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4095 <tag/Declaration/<tt/unsigned char kbhit (void);/
4096 <tag/Description/The function returns a value of zero if there is no character
4097 waiting to be read from the keyboard. It returns non zero otherwise.
4098 <tag/Notes/<itemize>
4099 <item>If the system does not support a keyboard buffer (most systems
4100 do), the function is rather useless.
4102 <tag/Availability/cc65
4104 <ref id="cgetc" name="cgetc">,
4105 <ref id="cursor" name="cursor">
4111 <sect1>labs<label id="labs"><p>
4115 <tag/Function/Returns the absolute value of a long integer.
4116 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4117 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4118 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4120 <tag/Notes/<itemize>
4121 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4122 <item>The function is only available as fastcall function, so it may only be
4123 used in presence of a prototype.
4125 <tag/Availability/ISO 9899
4127 <ref id="abs" name="abs">
4133 <sect1>ltoa<label id="ltoa"><p>
4137 <tag/Function/Convert a long integer into a string.
4138 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4139 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4140 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4141 using <tt/radix/ as the base.
4142 <tag/Notes/<itemize>
4143 <item>There are no provisions to prevent a buffer overflow.
4144 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4145 <item>The function is non standard, so it is not available in strict ANSI mode.
4146 You should probably use <tt/sprintf/ instead.
4147 <item>The function is only available as fastcall function, so it may only be
4148 used in presence of a prototype.
4150 <tag/Availability/cc65
4152 <ref id="atoi" name="atoi">,
4153 <ref id="atol" name="atol">,
4154 <ref id="itoa" name="itoa">,
4155 <ref id="ultoa" name="ultoa">,
4156 <ref id="utoa" name="utoa">
4162 <sect1>localeconv<label id="localeconv"><p>
4166 <tag/Function/Returns a pointer to the current locale structure.
4167 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4168 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4169 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4171 <tag/Notes/<itemize>
4172 <item>cc65 supports only the "C" locale, so even after setting a new locale
4173 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4176 <tag/Availability/ISO 9899
4178 <ref id="setlocale" name="setlocale">
4184 <sect1>longjmp<label id="longjmp"><p>
4188 <tag/Function/Non local goto.
4189 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4190 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4191 <tag/Description/The <tt/longjmp/ function restores a program context from the
4192 data in <tt/buf/, which must have been set by a preceeding call to
4193 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4194 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4196 <tag/Notes/<itemize>
4197 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4198 was called with a value of one.
4199 <item>The function is only available as fastcall function, so it may only
4200 be used in presence of a prototype.
4202 <tag/Availability/ISO 9899
4204 <ref id="setjmp" name="setjmp">
4210 <sect1>malloc<label id="malloc"><p>
4214 <tag/Function/Allocate dynamic memory.
4215 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4216 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4217 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4218 pointer to the allocated memory block. On error (not enough memory available),
4219 <tt/malloc/ returns <tt/NULL/.
4220 <tag/Notes/<itemize>
4221 <item>The function is only available as fastcall function, so it may only
4222 be used in presence of a prototype.
4224 <tag/Availability/ISO 9899
4226 <ref id="_heapadd" name="_heapadd">,
4227 <ref id="_heapblocksize" name="_heapblocksize">,
4228 <ref id="_heapmaxavail" name="_heapmaxavail">,
4229 <ref id="_heapmemavail" name="_heapmemavail">,
4230 <ref id="calloc" name="calloc">,
4231 <ref id="free" name="free">,
4232 <ref id="realloc" name="realloc">,
4233 <ref id="strdup" name="strdup">
4239 <sect1>memchr<label id="memchr"><p>
4243 <tag/Function/Search for a character in a block of raw memory.
4244 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4245 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4246 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4247 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4248 that is of size <tt/count/. Upon completion, the function returns a pointer to
4249 the character found, or a null pointer if the character was not found.
4250 <tag/Notes/<itemize>
4251 <item>The function is only available as fastcall function, so it may only
4252 be used in presence of a prototype.
4254 <tag/Availability/ISO 9899
4256 <ref id="strchr" name="strchr">
4262 <sect1>memcmp<label id="memcmp"><p>
4266 <tag/Function/Compare two memory areas.
4267 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4268 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4269 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4270 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4271 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4272 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4273 <tag/Notes/<itemize>
4274 <item>The function is only available as fastcall function, so it may only
4275 be used in presence of a prototype.
4277 <tag/Availability/ISO 9899
4279 <ref id="strcmp" name="strcmp">,
4280 <ref id="memmove" name="memmove">,
4281 <ref id="memset" name="memset">
4287 <sect1>memcpy<label id="memcpy"><p>
4291 <tag/Function/Copy a memory area.
4292 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4293 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4294 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4295 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4297 <tag/Notes/<itemize>
4298 <item>The result is undefined if the memory areas do overlap. Use
4299 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4300 <item>The function is only available as fastcall function, so it may only
4301 be used in presence of a prototype.
4303 <tag/Availability/ISO 9899
4305 <ref id="_swap" name="_swap">,
4306 <ref id="memmove" name="memmove">,
4307 <ref id="memset" name="memset">
4313 <sect1>memmove<label id="memmove"><p>
4317 <tag/Function/Copy a memory area.
4318 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4319 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4320 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4321 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4323 <tag/Notes/<itemize>
4324 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4325 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4326 <item>The function is only available as fastcall function, so it may only
4327 be used in presence of a prototype.
4329 <tag/Availability/ISO 9899
4331 <ref id="_swap" name="_swap">,
4332 <ref id="memcpy" name="memcpy">,
4333 <ref id="memset" name="memset">
4339 <sect1>memset<label id="memset"><p>
4343 <tag/Function/Fill a memory area.
4344 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4345 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4346 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4347 the value <tt/val/. The function returns <tt/p/.
4348 <tag/Notes/<itemize>
4349 <item>The function is only available as fastcall function, so it may only
4350 be used in presence of a prototype.
4352 <tag/Availability/ISO 9899
4354 <ref id="_swap" name="_swap">,
4355 <ref id="bzero" name="bzero">,
4356 <ref id="memcpy" name="memcpy">,
4357 <ref id="memmove" name="memmove">
4363 <sect1>mod_free<label id="mod_free"><p>
4367 <tag/Function/Free a relocatable module.
4368 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4369 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4370 <tag/Description/The function will free a module loaded into memory by use of
4371 the <tt/<ref id="mod_load" name="mod_load">/ function.
4372 <tag/Notes/<itemize>
4373 <item>The pointer passed as parameter is the pointer to the module memory,
4374 not the pointer to the control structure.
4375 <item>The function is available only as a fastcall function; so, it may be used
4376 only in the presence of a prototype.
4378 <tag/Availability/cc65
4380 <ref id="mod_load" name="mod_load">
4386 <sect1>mod_load<label id="mod_load"><p>
4390 <tag/Function/Load a relocatable module.
4391 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4392 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4393 <tag/Description/The function will load a code module into memory and relocate
4394 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4395 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4396 the module just loaded. Possible error codes are:
4398 <item><tt/MLOAD_OK/ - Module load successful
4399 <item><tt/MLOAD_ERR_READ/ - Read error
4400 <item><tt/MLOAD_ERR_HDR/ - Header error
4401 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4402 <item><tt/MLOAD_ERR_FMT/ - Data format error
4403 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4405 <tag/Notes/<itemize>
4406 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4407 relocatable o65 modules for use with this function.
4408 <item>The function is available only as a fastcall function; so, it may be used
4409 only in the presence of a prototype.
4411 <tag/Availability/cc65
4413 <ref id="mod_free" name="mod_free">
4419 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4423 <tag/Function/Specify a bounding box for the mouse cursor.
4424 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4425 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4426 <tag/Description/The function allows to set a bounding box for mouse movement.
4427 <tag/Notes/<itemize>
4428 <item>The function does not check if the mouse cursor is currently within the
4429 given rectangle. Placing the mouse cursor within the bounding box is the
4430 responsibility of the programmer.
4431 <item>While the bounding box may be larger than the actual screen size, the
4432 standard mouse cursor draw routines may fail to set the cursor to coordinates
4433 outside of the screen area. Depending on the platform, you may have to supply
4434 your own mouse cursor routines.
4435 <item>The function is only available as fastcall function, so it may only be
4436 used in presence of a prototype.
4438 <tag/Availability/cc65
4440 <ref id="mouse_getbox" name="mouse_getbox">,
4441 <ref id="mouse_move" name="mouse_move">
4447 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4451 <tag/Function/Return the current bounding box for the mouse cursor.
4452 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4453 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4454 <tag/Description/The function queries the current bounding box for mouse
4456 <tag/Notes/<itemize>
4457 <item>The function is only available as fastcall function, so it may only be
4458 used in presence of a prototype.
4460 <tag/Availability/cc65
4462 <ref id="mouse_move" name="mouse_move">,
4463 <ref id="mouse_setbox" name="mouse_setbox">
4469 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4473 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4474 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4475 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4476 <tag/Description/The function returns a bit mask that encodes the state of the
4477 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4479 <tag/Availability/cc65
4481 <ref id="mouse_info" name="mouse_info">,
4482 <ref id="mouse_pos" name="mouse_pos">
4488 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4492 <tag/Function/Return a readable error message for an error code.
4493 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4494 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4496 <tag/Description/The function returns an error message (in english) for the
4497 error code passed parameter.
4498 <tag/Notes/<itemize>
4499 <item>The function will return "Unknown error" for invalid error codes.
4500 <item>The function is only available as fastcall function, so it may only be
4501 used in presence of a prototype.
4503 <tag/Availability/cc65
4505 <ref id="mouse_load_driver" name="mouse_load_driver">,
4506 <ref id="mouse_uninstall" name="mouse_uninstall">,
4507 <ref id="mouse_unload" name="mouse_unload">
4513 <sect1>mouse_hide<label id="mouse_hide"><p>
4517 <tag/Function/Hide the mouse pointer.
4518 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4519 <tag/Declaration/<tt/void mouse_hide (void);/
4520 <tag/Description/The function hides the mouse pointer. It manages a counter
4521 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4522 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4523 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4525 <tag/Availability/cc65
4527 <ref id="mouse_show" name="mouse_show">
4533 <sect1>mouse_info<label id="mouse_info"><p>
4537 <tag/Function/Return the state of the mouse buttons and the position of the
4539 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4540 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
4541 <tag/Description/The function returns the state of the mouse buttons and the
4542 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
4543 <tag/Notes/<itemize>
4544 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
4545 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
4546 name="mouse_pos">/ instead.
4547 <item>The function is only available as fastcall function, so it may only be
4548 used in presence of a prototype.
4550 <tag/Availability/cc65
4552 <ref id="mouse_buttons" name="mouse_buttons">,
4553 <ref id="mouse_pos" name="mouse_pos">
4559 <sect1>mouse_install<label id="mouse_install"><p>
4563 <tag/Function/Install an already loaded mouse driver.
4564 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4565 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
4566 mouse_callbacks* c, void* driver);/
4567 <tag/Description/The function installs an already loaded mouse driver and
4568 returns an error code. The <tt/mouse_callbacks/ structure passed as first
4569 parameter contains pointers to routines needed to move or hide/show the mouse
4570 pointer. Defaults for these routines are supplied by the library, so if you
4571 can live with these defaults (which are platform specific), just pass a
4572 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
4573 driver linked statically to the program.
4574 <tag/Notes/<itemize>
4575 <item>Not all drivers are able to detect if the supported hardware is really
4577 <item>After installing a driver, the mouse cursor is hidden.
4578 <item>The function is only available as fastcall function, so it may only be
4579 used in presence of a prototype.
4581 <tag/Availability/cc65
4583 <ref id="mouse_load_driver" name="mouse_load_driver">,
4584 <ref id="mouse_uninstall" name="mouse_uninstall">,
4585 <ref id="mouse_unload" name="mouse_unload">
4591 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
4595 <tag/Function/Call the driver specific ioctl function.
4596 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4597 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
4598 <tag/Description/The function calls the IOCTL entry in the mouse driver,
4599 which is driver specific. The <tt/code/ parameter will choose between
4600 different IOCTL functions, and the <tt/data/ depends on code. The
4601 function returns an error code. The purpose of this function is to allow
4602 for driver specific extensions. See the documentation for a specific mouse
4603 driver for supported ioctl calls.
4604 <tag/Notes/<itemize>
4605 <item>Calling this function is non portable, because each driver may
4606 implement different ioctl calls (or none at all).
4607 <item>The function is only available as fastcall function, so it may only be
4608 used in presence of a prototype.
4610 <tag/Availability/cc65
4616 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
4620 <tag/Function/Load and initialize a mouse driver.
4621 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4622 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
4623 mouse_callbacks* c, const char* driver);/
4624 <tag/Description/Load a mouse driver into memory and initialize it. The
4625 function returns an error code that tells if the call has been successful. The
4626 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
4627 routines needed to move or hide/show the mouse pointer. Defaults for these
4628 routines are supplied by the library, so if you can live with these defaults
4629 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
4630 <tag/Notes/<itemize>
4631 <item>The driver is loaded by name, so currently you must know the type of
4632 mouse that should be supported. There is no autodetect capability.
4633 <item>Not all drivers are able to detect if the supported hardware is really
4635 <item>After installing a driver, the mouse cursor is hidden.
4636 <item>The function is only available as fastcall function, so it may only be
4637 used in presence of a prototype.
4639 <tag/Availability/cc65
4641 <ref id="mouse_install" name="mouse_install">,
4642 <ref id="mouse_uninstall" name="mouse_uninstall">,
4643 <ref id="mouse_unload" name="mouse_unload">
4649 <sect1>mouse_move<label id="mouse_move"><p>
4653 <tag/Function/Move the mouse cursor to a specific position.
4654 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4655 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
4656 <tag/Description/The function updates the mouse position. If the mouse cursor
4657 is visible, it is shown at the new position.
4658 <tag/Notes/<itemize>
4659 <item>The function does not check if the new position is within the bounding
4660 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
4661 <item>The function is only available as fastcall function, so it may only be
4662 used in presence of a prototype.
4664 <tag/Availability/cc65
4666 <ref id="mouse_getbox" name="mouse_getbox">,
4667 <ref id="mouse_setbox" name="mouse_setbox">
4673 <sect1>mouse_pos<label id="mouse_pos"><p>
4677 <tag/Function/Return the position of the mouse.
4678 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4679 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
4680 <tag/Description/The function returns the position of the mouse in the
4681 <tt/mouse_pos/ structure passed as parameter.
4682 <tag/Notes/<itemize>
4683 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
4684 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
4685 name="mouse_info">/ instead.
4686 <item>The function is only available as fastcall function, so it may only be
4687 used in presence of a prototype.
4689 <tag/Availability/cc65
4691 <ref id="mouse_buttons" name="mouse_buttons">,
4692 <ref id="mouse_info" name="mouse_info">
4698 <sect1>mouse_show<label id="mouse_show"><p>
4702 <tag/Function/Show the mouse pointer.
4703 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4704 <tag/Declaration/<tt/void mouse_show (void);/
4705 <tag/Description/The function shows the mouse pointer. It manages a counter
4706 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
4707 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
4708 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
4709 <tag/Availability/cc65
4711 <ref id="mouse_hide" name="mouse_hide">
4717 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
4721 <tag/Function/Uninstall an already loaded mouse driver.
4722 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4723 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
4724 <tag/Description/The function uninstalls an already loaded mouse driver but
4725 don't removes it from memory.
4726 <tag/Notes/<itemize>
4727 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
4728 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
4729 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
4732 <tag/Availability/cc65
4734 <ref id="mouse_install" name="mouse_install">,
4735 <ref id="mouse_load_driver" name="mouse_load_driver">,
4736 <ref id="mouse_unload" name="mouse_unload">
4742 <sect1>mouse_unload<label id="mouse_unload"><p>
4746 <tag/Function/Unload a mouse driver.
4747 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4748 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
4749 <tag/Description/The function unloads a loaded mouse driver and frees all
4750 memory allocated for the driver.
4751 <tag/Notes/<itemize>
4752 <item>The function does nothing if no driver is loaded.
4754 <tag/Availability/cc65
4756 <ref id="mouse_install" name="mouse_install">,
4757 <ref id="mouse_load_driver" name="mouse_load_driver">,
4758 <ref id="mouse_uninstall" name="mouse_uninstall">
4764 <sect1>offsetof<label id="offsetof"><p>
4768 <tag/Function/Calculate the offset of a struct or union member.
4769 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
4770 <tag/Declaration/<tt/size_t offsetof (type, member);/
4771 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
4772 or <tt/union/ member.
4773 <tag/Notes/<itemize>
4774 <item>The function is actually a macro.
4776 <tag/Availability/ISO 9899
4782 <sect1>open<label id="open"><p>
4786 <tag/Function/Open and possibly create a file.
4787 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
4788 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
4789 <tag/Description/<tt/open/ opens a file and returns the file descriptor
4790 associated with it. On error, -1 is returned and an error code is stored in
4791 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
4792 <tag/Notes/<itemize>
4793 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
4794 open, which is used as the permission mask when a new file is created. While
4795 cc65 allows to pass this argument, it is ignored.
4797 <tag/Availability/POSIX 1003.1
4799 <ref id="close" name="close">,
4800 <ref id="creat" name="creat">
4806 <sect1>opendir<label id="opendir"><p>
4810 <tag/Function/Open a directory.
4811 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
4812 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
4813 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
4814 descriptor associated with it. On error, NULL is returned and an error code is
4815 stored in <tt/errno/.
4816 <tag/Notes/<itemize>
4817 <item>The function is only available as fastcall function, so it may only
4818 be used in presence of a prototype.
4820 <tag/Availability/POSIX 1003.1
4822 <ref id="closedir" name="closedir">,
4823 <ref id="readdir" name="readdir">
4829 <sect1>peekbsys<label id="peekbsys"><p>
4833 <tag/Function/Read one byte from a location in the system bank.
4834 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4835 <tt/<ref id="cbm510.h" name="cbm510.h">/
4836 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
4837 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
4838 system bank (bank 15) of the CBM PET-II machines and returns it.
4839 <tag/Notes/<itemize>
4840 <item>The function is only available as fastcall function, so it may only
4841 be used in presence of a prototype.
4842 <item>This function may be a macro depending on the compiler options. The
4843 actual function is accessible by #undef'ing the macro.
4845 <tag/Availability/cc65
4847 <ref id="PEEK" name="PEEK">,
4848 <ref id="PEEKW" name="PEEKW">,
4849 <ref id="peekwsys" name="peekwsys">,
4850 <ref id="pokebsys" name="pokebsys">,
4851 <ref id="pokewsys" name="pokewsys">
4857 <sect1>peekwsys<label id="peekwsys"><p>
4861 <tag/Function/Read one word from a location in the system bank.
4862 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4863 <tt/<ref id="cbm510.h" name="cbm510.h">/
4864 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
4865 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
4866 system bank (bank 15) of the CBM PET-II machines and returns it. Following
4867 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
4868 high byte is read from <tt/addr+1/.
4869 <tag/Notes/<itemize>
4870 <item>The function is only available as fastcall function, so it may only
4871 be used in presence of a prototype.
4872 <item>The order in which the two bytes are read is undefined.
4874 <tag/Availability/cc65
4876 <ref id="PEEK" name="PEEK">,
4877 <ref id="PEEKW" name="PEEKW">,
4878 <ref id="peekbsys" name="peekbsys">,
4879 <ref id="pokebsys" name="pokebsys">,
4880 <ref id="pokewsys" name="pokewsys">
4886 <sect1>perror<label id="perror"><p>
4890 <tag/Function/Print an error message for the error in <tt/errno/.
4891 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4892 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
4893 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
4894 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
4895 a blank. Then the error message for the current contents of <tt/errno/ is
4896 printed followed by a newline. The message output is the same as returned by
4897 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
4898 <tag/Notes/<itemize>
4899 <item>The function is only available as fastcall function, so it may only
4900 be used in presence of a prototype.
4902 <tag/Availability/ISO 9899
4904 <ref id="_poserror" name="_poserror">,
4905 <ref id="strerror" name="strerror">
4911 <sect1>pokebsys<label id="pokebsys"><p>
4915 <tag/Function/Write one byte to a location in the system bank.
4916 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4917 <tt/<ref id="cbm510.h" name="cbm510.h">/
4918 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
4919 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
4920 system bank (bank 15) of the CBM PET-II machines.
4921 <tag/Notes/<itemize>
4922 <item>The function is only available as fastcall function, so it may only
4923 be used in presence of a prototype.
4925 <tag/Availability/cc65
4927 <ref id="POKE" name="POKE">,
4928 <ref id="POKEW" name="POKEW">,
4929 <ref id="peekbsys" name="peekbsys">,
4930 <ref id="peekwsys" name="peekwsys">,
4931 <ref id="pokewsys" name="pokewsys">
4937 <sect1>pokewsys<label id="pokewsys"><p>
4941 <tag/Function/Write one word to a location in the system bank.
4942 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4943 <tt/<ref id="cbm510.h" name="cbm510.h">/
4944 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
4945 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
4946 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
4947 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
4948 high byte is written to <tt/addr+1/.
4949 <tag/Notes/<itemize>
4950 <item>The function is only available as fastcall function, so it may only
4951 be used in presence of a prototype.
4952 <item>The order in which the two bytes are written is undefined.
4954 <tag/Availability/cc65
4956 <ref id="POKE" name="POKE">,
4957 <ref id="POKEW" name="POKEW">,
4958 <ref id="peekbsys" name="peekbsys">,
4959 <ref id="peekwsys" name="peekwsys">,
4960 <ref id="pokebsys" name="pokebsys">
4966 <sect1>qsort<label id="qsort"><p>
4970 <tag/Function/Sort an array.
4971 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4972 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
4973 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
4974 <tag/Description/<tt/qsort/ sorts an array according to a given compare
4975 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
4976 is the number of elements, <tt/size/ the size of an element and <tt/compare/
4977 the function used to compare the members.
4978 <tag/Notes/<itemize>
4979 <item>If there are multiple members with the same key, the order after calling
4980 the function is undefined.
4981 <item>The function is only available as fastcall function, so it may only
4982 be used in presence of a prototype.
4983 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
4986 <tag/Availability/ISO 9899
4988 <ref id="bsearch" name="bsearch">
4994 <sect1>raise<label id="raise"><p>
4998 <tag/Function/Send a signal to the executing program.
4999 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5000 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5001 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5002 program has installed a signal handler for the signal, this signal handler
5003 will be executed. If no handler has been installed, the default action for
5004 the raised signal will be taken. The function returns zero on success,
5006 <tag/Notes/<itemize>
5007 <item>The function is only available as fastcall function, so it may only
5008 be used in presence of a prototype.
5010 <tag/Availability/ISO 9899
5012 <ref id="abort" name="abort">,
5013 <ref id="signal" name="signal">
5019 <sect1>rand<label id="rand"><p>
5023 <tag/Function/Return a pseudo random number.
5024 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5025 <tag/Declaration/<tt/int rand (void);/
5026 <tag/Description/The function returns a pseudo random number
5027 between 0 and <tt/RAND_MAX/ (exclusive).
5028 <tag/Notes/<itemize>
5029 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5030 flow of numbers is generated.
5031 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5032 had been used with an argument of 1.
5034 <tag/Availability/ISO 9899
5036 <ref id="_randomize" name="_randomize">,
5037 <ref id="srand" name="srand">
5043 <sect1>readdir<label id="readdir"><p>
5047 <tag/Function/Read a directory.
5048 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5049 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5050 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5051 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5052 and returns a pointer to it. If the end of directory is reached, or an error
5053 occurs, NULL is returned. In case of errors, an error code is stored into
5055 <tag/Notes/<itemize>
5056 <item>The function is only available as fastcall function, so it may only
5057 be used in presence of a prototype.
5058 <item>The returned pointer may point to a statically allocated instance of
5059 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5061 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5062 confused when opening/closing files between directory reads. So for example a
5063 program that reads the list of files on a disk, and after each call to
5064 <tt/readdir/, opens the file to process it, will fail.<newline>
5065 Possible solutions are reading the directory into memory before processing the
5066 file list, or to reset the directory by seeking to the correct position after
5067 opening/closing a file:
5069 seekdir (DIR, telldir (DIR));
5071 Platforms known to work without problems are: Apple.
5073 <tag/Availability/POSIX 1003.1
5075 <ref id="closedir" name="closedir">,
5076 <ref id="opendir" name="opendir">
5082 <sect1>realloc<label id="realloc"><p>
5086 <tag/Function/Change the size of an allocated memory block.
5087 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5088 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5089 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5090 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5091 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5092 behaves as if <tt/free/ had been called. On error (not enough memory
5093 available), <tt/realloc/ returns <tt/NULL/.
5094 <tag/Notes/<itemize>
5095 <item>The part of the memory block that is returned will have its contents
5097 <item>This function is somewhat dangerous to use. Be careful to save the
5098 pointer you're passing somewhere else, otherwise
5100 ptr = realloc (ptr, size);
5102 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5103 <item>The function is only available as fastcall function, so it may only
5104 be used in presence of a prototype.
5106 <tag/Availability/ISO 9899
5108 <ref id="_heapadd" name="_heapadd">,
5109 <ref id="_heapblocksize" name="_heapblocksize">,
5110 <ref id="_heapmaxavail" name="_heapmaxavail">,
5111 <ref id="_heapmemavail" name="_heapmemavail">,
5112 <ref id="calloc" name="calloc">,
5113 <ref id="free" name="free">,
5114 <ref id="realloc" name="realloc">
5120 <sect1>remove<label id="remove"><p>
5124 <tag/Function/Delete a file.
5125 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5126 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5127 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5128 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5129 code describing the reason for the failure.
5130 <tag/Notes/<itemize>
5131 <item>This function is not available on all cc65 targets (depends on the
5132 availability of file I/O).
5133 <item>The function is only available as fastcall function, so it may only
5134 be used in presence of a prototype.
5136 <tag/Availability/ISO 9899
5138 <ref id="rename" name="rename">,
5139 <ref id="unlink" name="unlink">
5142 #include <stdio.h>
5144 #define FILENAME "helloworld"
5146 if (remove (FILENAME) == 0) {
5147 printf ("We deleted %s successfully\n", FILENAME);
5149 printf ("There was a problem deleting %s\n", FILENAME);
5156 <sect1>rename<label id="rename"><p>
5160 <tag/Function/Rename a file.
5161 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5162 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5163 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5164 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5165 code describing the reason for the failure.
5166 <tag/Notes/<itemize>
5167 <item>This function is not available on all cc65 targets (depends on the
5168 capabilities of the storage devices).
5169 <item>The function is only available as fastcall function, so it may only
5170 be used in presence of a prototype.
5172 <tag/Availability/ISO 9899
5174 <ref id="remove" name="remove">
5177 #include <stdio.h>
5179 #define OLDNAME "textfile.txt"
5180 #define NEWNAME "textfile.bak"
5182 if (rename (OLDNAME, NEWNAME) == 0) {
5183 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5185 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5192 <sect1>reset_brk<label id="reset_brk"><p>
5196 <tag/Function/Resets the break vector to its original value.
5197 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5198 <tag/Declaration/<tt/void reset_brk (void);/
5199 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5200 before a call to <tt/set_brk/.
5201 <tag/Notes/<itemize>
5202 <item>The break vector is reset on program termination, so it's not strictly
5203 necessary to call this function as a part of your clean-up when exitting the program.
5205 <tag/Availability/cc65
5207 <ref id="reset_irq" name="reset_irq">,
5208 <ref id="set_brk" name="set_brk">,
5209 <ref id="set_irq" name="set_irq">
5215 <sect1>reset_irq<label id="reset_irq"><p>
5219 <tag/Function/Resets the C level interrupt request vector.
5220 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5221 <tag/Declaration/<tt/void reset_irq (void);/
5222 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5223 <tag/Notes/<itemize>
5224 <item>The interrupt vector is reset on program termination, so it's not strictly
5225 necessary to call this function as a part of your clean-up when exitting the program.
5227 <tag/Availability/cc65
5229 <ref id="reset_brk" name="reset_brk">,
5230 <ref id="set_brk" name="set_brk">,
5231 <ref id="set_irq" name="set_irq">
5237 <sect1>revers<label id="revers"><p>
5241 <tag/Function/Control revers character display.
5242 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5243 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5244 <tag/Description/If the argument is non zero, the function enables reverse
5245 character display. If the argument is zero, reverse character display is
5246 switched off. The old value of the setting is returned.
5247 <tag/Notes/<itemize>
5248 <item>The function may not be supported by the hardware, in which case
5249 the call is ignored.
5250 <item>The function is only available as fastcall function, so it may only
5251 be used in presence of a prototype.
5253 <tag/Availability/cc65
5255 <ref id="textcolor" name="textcolor">
5261 <sect1>rewinddir<label id="rewinddir"><p>
5265 <tag/Function/Reset a directory stream.
5266 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5267 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5268 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5269 pointed to by <tt/dir/ to the start of the directory.
5270 <tag/Notes/<itemize>
5271 <item>The function is only available as fastcall function, so it may only
5272 be used in presence of a prototype.
5274 <tag/Availability/POSIX 1003.1
5276 <ref id="seekdir" name="seekdir">,
5277 <ref id="telldir" name="telldir">
5283 <sect1>screensize<label id="screensize"><p>
5287 <tag/Function/Return the dimensions of the text mode screen.
5288 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5289 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5290 <tag/Description/The function returns the dimensions of the text mode screen.
5291 <tag/Notes/<itemize>
5292 <item>The function is only available as fastcall function, so it may only
5293 be used in presence of a prototype.
5295 <tag/Availability/cc65
5297 <ref id="gotox" name="gotox">,
5298 <ref id="gotoxy" name="gotoxy">,
5299 <ref id="gotoy" name="gotoy">,
5300 <ref id="wherex" name="wherex">,
5301 <ref id="wherey" name="wherey">
5307 <sect1>seekdir<label id="seekdir"><p>
5311 <tag/Function/Set the position of a directory stream.
5312 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5313 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5314 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5315 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5316 value returned by <tt/<ref id="telldir" name="telldir">/.
5317 <tag/Notes/<itemize>
5318 <item>The function is only available as fastcall function, so it may only
5319 be used in presence of a prototype.
5321 <tag/Availability/POSIX 1003.1
5323 <ref id="rewinddir" name="rewinddir">,
5324 <ref id="telldir" name="telldir">
5330 <sect1>ser_close<label id="ser_close"><p>
5334 <tag/Function/Close the port and disable interrupts
5335 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5336 <tag/Declaration/<tt/unsigned char ser_close (void);/
5337 <tag/Description/Close the port by clearing buffers and disable interrupts.
5338 <tag/Availability/cc65
5339 <tag/See also/Other serial functions.
5344 static void initialize(){
5345 struct ser_params params = {
5352 ser_install(lynx_comlynx); // This will activate the ComLynx
5354 ser_open(&params);
5361 <sect1>ser_get<label id="ser_get"><p>
5365 <tag/Function/Read a character from serial port.
5366 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5367 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5368 <tag/Description/Get a character from the serial port. If no characters are
5369 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5371 <tag/Notes/<itemize>
5372 <item>The function is only available as fastcall function, so it may only
5373 be used in presence of a prototype.
5375 <tag/Availability/cc65
5376 <tag/See also/Other serial functions.
5378 Wait for a character to be available from a serial port.
5381 while (ser_get(&ch) == SER_ERR_NO_DATA)
5388 <sect1>ser_install<label id="ser_install"><p>
5392 <tag/Function/Install an already loaded driver and return an error code.
5393 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5394 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5395 <tag/Description/The function installs a driver that was already loaded into
5396 memory (or linked statically to the program). It returns an error code
5397 (<tt/SER_ERR_OK/ in case of success).
5398 <tag/Notes/<itemize>
5399 <item>The function is only available as fastcall function, so it may only be
5400 used in presence of a prototype.
5402 <tag/Availability/cc65
5404 <ref id="ser_load_driver" name="ser_load_driver">,
5405 <ref id="ser_uninstall" name="ser_uninstall">,
5406 <ref id="ser_unload" name="ser_unload">
5408 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5414 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5418 <tag/Function/Platform dependent code extensions.
5419 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5420 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5421 <tag/Description/Some platforms have extra serial functions that are not
5422 supported by standard serial driver functions. You can extend the driver to support
5423 this extra functionality bt using ser_ioctl functions.
5424 <tag/Notes/<itemize>
5425 <item>The function is only available as fastcall function, so it may only
5426 be used in presence of a prototype.
5427 <item>These functions are not easily portable to other cc65 platforms.
5429 <tag/Availability/cc65
5430 <tag/See also/Other serial functions.
5435 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5439 <tag/Function/Load and install a serial driver.
5440 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5441 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5442 <tag/Description/Load and install the driver by name.
5443 Will just load the driver and check if loading was successful.
5444 <tag/Notes/<itemize>
5445 <item>The function is only available as fastcall function, so it may only
5446 be used in presence of a prototype.
5448 <tag/Availability/cc65
5449 <tag/See also/Other serial functions.
5455 <sect1>ser_open<label id="ser_open"><p>
5459 <tag/Function/Open the port by setting the port parameters and enable interrupts
5460 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5461 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5462 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5463 <tag/Notes/<itemize>
5464 <item>The function is only available as fastcall function, so it may only
5465 be used in presence of a prototype.
5467 <tag/Availability/cc65
5468 <tag/See also/Other serial functions.
5473 static void initialize(){
5474 struct ser_params params = {
5481 ser_install(lynx_comlynx); // This will activate the ComLynx
5483 ser_open(&params);
5490 <sect1>ser_put<label id="ser_put"><p>
5494 <tag/Function/Write a character to a serial port.
5495 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5496 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5497 <tag/Description/Send a character via the serial port. There is a transmit
5498 buffer, but transmitting is not done via interrupt. The function returns
5499 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5500 <tag/Notes/<itemize>
5501 <item>The function is only available as fastcall function, so it may only
5502 be used in presence of a prototype.
5504 <tag/Availability/cc65
5505 <tag/See also/Other serial functions.
5514 <sect1>ser_status<label id="ser_status"><p>
5518 <tag/Function/Return the serial port status.
5519 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5520 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5521 <tag/Description/Return the serial port status.
5522 <tag/Notes/<itemize>
5523 <item>The function is only available as fastcall function, so it may only
5524 be used in presence of a prototype.
5526 <tag/Availability/cc65
5527 <tag/See also/Other serial functions.
5533 <sect1>ser_uninstall<label id="ser_uninstall"><p>
5537 <tag/Function/Uninstall the currently loaded driver but do not unload it.
5538 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5539 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
5540 <tag/Description/Uninstall the currently loaded driver but do not unload it.
5541 <tag/Availability/cc65
5542 <tag/See also/Other serial functions.
5547 <sect1>ser_unload<label id="ser_unload"><p>
5551 <tag/Function/Uninstall, then unload the currently loaded driver.
5552 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5553 <tag/Declaration/<tt/unsigned char ser_unload (void);/
5554 <tag/Description/Uninstall, then unload the currently loaded driver.
5555 <tag/Availability/cc65
5556 <tag/See also/Other serial functions.
5562 <sect1>set_brk<label id="set_brk"><p>
5566 <tag/Function/Set the break vector to a user function.
5567 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5568 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
5569 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
5570 program code by letting the vector point to a user written C function. The
5571 runtime library installs a small stub that saves the registers into global
5572 variables that may be accessed (and changed) by the break handler.
5573 <tag/Notes/<itemize>
5574 <item>The function is only available as fastcall function, so it may only
5575 be used in presence of a prototype.
5576 <item>The stub saves the zero page registers used by the C runtime and switches
5577 to a small break handler stack. This means that it is safe to execute C code,
5578 even if C code was interrupted. Be careful however not to use too many local
5579 variables, and do not enable stack checks for the handler function or any other
5580 function called from it.
5581 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
5582 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
5583 otherwise the <tt/BRK/ instruction will get executed over and over again.
5584 <item>The break vector is reset on program termination, so it's not strictly
5585 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
5586 clean-up when exitting the program.
5588 <tag/Availability/cc65
5590 <ref id="reset_brk" name="reset_brk">
5596 <sect1>set_irq<label id="set_irq"><p>
5600 <tag/Function/Set the C level interrupt request vector to the given address.
5601 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5602 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
5603 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
5604 (IRQs) within the program code by letting the vector point to a user written C
5605 function. The runtime library installs a small stub that saves the zero page
5606 registers used by the C runtime before calling the handler function and restores
5607 them after the handler function returns. Additionally the stub temporarily switches
5608 the C runtime stack to the stack area provided as parameter. If the handler function
5609 was set up to handle a "private", "exclusive" interrupt request source it must
5610 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
5611 interrupt request actually stems from that source. In all other cases it must return
5612 the value <tt/IRQ_NOT_HANDLED/.
5613 <tag/Notes/<itemize>
5614 <item>The function is only available as fastcall function, so it may only
5615 be used in presence of a prototype.
5616 <item>The stub saves the registers and zero page locations used by the C runtime
5617 and switches to the provided stack area. As a consequence, there is some
5618 runtime overhead, but it it is safe to execute C code, even if other C code
5619 was interrupted. Be careful however not to call C library functions, and do not
5620 enable stack checks for the handler function or any other function called from
5622 <item>The interrupt vector is reset on program termination, so it's not strictly
5623 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
5624 clean-up when exitting the program.
5626 <tag/Availability/cc65
5628 <ref id="reset_brk" name="reset_brk">,
5629 <ref id="reset_irq" name="reset_irq">,
5630 <ref id="set_brk" name="set_brk">
5636 <sect1>setjmp<label id="setjmp"><p>
5640 <tag/Function/Save the context for use with <tt/longjmp/.
5641 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
5642 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
5643 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
5644 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
5646 <tag/Notes/<itemize>
5647 <item>The function is only available as fastcall function, so it may only
5648 be used in presence of a prototype.
5649 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
5650 <item><tt/setjmp/ will not save the signal context.
5652 <tag/Availability/ISO 9899
5654 <ref id="longjmp" name="longjmp">
5660 <sect1>setlocale<label id="setlocale"><p>
5664 <tag/Function/Selects a locale.
5665 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
5666 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
5667 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
5668 <tag/Notes/<itemize>
5669 <item>The function is only available as fastcall function, so it may only
5670 be used in presence of a prototype.
5671 <item>cc65 supports only the "C" locale, so calling this function to set a
5672 different locale has no effect.
5674 <tag/Availability/ISO 9899
5676 <ref id="localeconv" name="localeconv">,
5677 <ref id="strcoll" name="strcoll">
5678 <ref id="strxfrm" name="strxfrm">
5684 <sect1>signal<label id="signal"><p>
5688 <tag/Function/Install a signal handler.
5689 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5690 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
5691 <tag/Description/<tt/signal/ installs a handler for the given signal. The
5692 handler may either be a user supplied function, or one of the predefined
5693 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
5694 previous value if the signal , or the special function vector SIG_ERR in
5696 <tag/Notes/<itemize>
5697 <item>The function is only available as fastcall function, so it may only
5698 be used in presence of a prototype.
5700 <tag/Availability/ISO 9899
5702 <ref id="abort" name="abort">,
5703 <ref id="raise" name="raise">
5709 <sect1>sleep<label id="sleep"><p>
5713 <tag/Function/Sleep for a specified amount of time.
5714 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
5715 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
5716 <tag/Description/The function will return after the specified number of
5717 seconds have elapsed.
5718 <tag/Notes/<itemize>
5719 <item>The function is only available as fastcall function, so it may only
5720 be used in presence of a prototype.
5722 <tag/Availability/POSIX 1003.1
5728 <sect1>slow<label id="slow"><p>
5732 <tag/Function/Switch the C128 into 1MHz mode.
5733 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
5734 <tag/Declaration/<tt/void slow (void);/
5735 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
5736 will halve the speed compared to fast mode.
5737 <tag/Notes/<itemize>
5738 <item>The function is specific to the C128.
5740 <tag/Availability/C128
5742 <ref id="fast" name="fast">,
5743 <ref id="toggle_videomode" name="toggle_videomode">,
5744 <ref id="videomode" name="videomode">
5750 <sect1>srand<label id="srand"><p>
5754 <tag/Function/Initialize the pseudo random number generator.
5755 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5756 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
5757 <tag/Description/The function initializes the random number generator using
5758 the given seed. On program startup, the generator behaves as if <tt/srand/ has
5759 been called with an argument of 1.
5760 <tag/Notes/<itemize>
5761 <item>The function is only available as fastcall function, so it may only
5762 be used in presence of a prototype.
5764 <tag/Availability/ISO 9899
5766 <ref id="_randomize" name="_randomize">,
5767 <ref id="rand" name="rand">
5773 <sect1>strcasecmp<label id="strcasecmp"><p>
5777 <tag/Function/Compare two strings case insensitive.
5778 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5779 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
5780 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
5781 as parameters without case sensitivity. It returns a value that is less than
5782 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
5783 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
5784 <tag/Notes/<itemize>
5785 <item>The function is only available as fastcall function, so it may only
5786 be used in presence of a prototype.
5787 <item>The function is not available in strict ANSI mode.
5789 <tag/Availability/cc65
5791 <ref id="strcmp" name="strcmp">,
5792 <ref id="strcoll" name="strcoll">,
5793 <ref id="stricmp" name="stricmp">,
5794 <ref id="strncmp" name="strncmp">,
5795 <ref id="strxfrm" name="strxfrm">
5801 <sect1>strcat<label id="strcat"><p>
5805 <tag/Function/Concatentate two strings.
5806 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5807 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
5808 <tag/Description/The <tt/strcat/ function appends a copy of the string
5809 pointed to by s2 (including the terminating null byte) to the end of the
5810 string pointed to by s1. The initial byte of s2 overwrites the null byte at
5812 <tag/Notes/<itemize>
5813 <item>The function is only available as fastcall function, so it may only
5814 be used in presence of a prototype.
5815 <item>If copying takes place between objects that overlap, the behaviour
5818 <tag/Availability/ISO 9899
5820 <ref id="strcpy" name="strcpy">,
5821 <ref id="strncat" name="strncat">,
5822 <ref id="strncpy" name="strncpy">
5828 <sect1>strchr<label id="strchr"><p>
5832 <tag/Function/Search for a character in a string.
5833 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5834 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
5835 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
5836 (converted to a char) in the string pointed to by <tt/s/. The terminating null
5837 byte is considered to be part of the string. Upon completion, the function
5838 returns a pointer to the byte, or a null pointer if the byte was not found.
5839 <tag/Notes/<itemize>
5840 <item>The function is only available as fastcall function, so it may only
5841 be used in presence of a prototype.
5843 <tag/Availability/ISO 9899
5845 <ref id="memchr" name="memchr">,
5846 <ref id="strrchr" name="strrchr">
5852 <sect1>strcmp<label id="strcmp"><p>
5856 <tag/Function/Compare two strings.
5857 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5858 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
5859 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
5860 parameters. It returns a value that is less than zero if <tt/s1/ is less than
5861 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
5862 if <tt/s1/ is greater than <tt/s2/.
5863 <tag/Notes/<itemize>
5864 <item>The function is only available as fastcall function, so it may only
5865 be used in presence of a prototype.
5867 <tag/Availability/ISO 9899
5869 <ref id="strcasecmp" name="strcasecmp">,
5870 <ref id="strcoll" name="strcoll">,
5871 <ref id="stricmp" name="stricmp">,
5872 <ref id="strncmp" name="strncmp">
5873 <ref id="strxfrm" name="strxfrm">
5879 <sect1>strcoll<label id="strcoll"><p>
5883 <tag/Function/Compare two strings.
5884 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5885 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
5886 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
5887 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
5888 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
5889 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
5890 than zero if <tt/s1/ is greater than <tt/s2/.
5891 <tag/Notes/<itemize>
5892 <item>The function is only available as fastcall function, so it may only
5893 be used in presence of a prototype.
5895 <tag/Availability/ISO 9899
5897 <ref id="setlocale" name="setlocale">,
5898 <ref id="strcasecmp" name="strcasecmp">,
5899 <ref id="strcmp" name="strcmp">,
5900 <ref id="stricmp" name="stricmp">,
5901 <ref id="strncmp" name="strncmp">,
5902 <ref id="strxfrm" name="strxfrm">
5908 <sect1>strcpy<label id="strcpy"><p>
5912 <tag/Function/Copy a string.
5913 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5914 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
5915 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
5916 <tt/s2/ (including the terminating null byte) into the array pointed to by
5917 <tt/s1/. The function will always return <tt/s1/.
5918 <tag/Notes/<itemize>
5919 <item>The function is only available as fastcall function, so it may only
5920 be used in presence of a prototype.
5921 <item>If copying takes place between objects that overlap, the behaviour
5924 <tag/Availability/ISO 9899
5926 <ref id="strcat" name="strcat">,
5927 <ref id="strncat" name="strncat">,
5928 <ref id="strncpy" name="strncpy">
5931 #include <string.h>
5933 static char hello[14];
5935 strcpy (hello, "Hello world!\n");
5941 <sect1>strcspn<label id="strcspn"><p>
5945 <tag/Function/Compute the length of a substring.
5946 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5947 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
5948 <tag/Description/The <tt/strcspn/ function computes and returns the length of
5949 the substring pointed to by <tt/s/ which does <em>not</em> consist of
5950 characters contained in the string <tt/set/.
5951 <tag/Notes/<itemize>
5952 <item>The function is only available as fastcall function, so it may only
5953 be used in presence of a prototype.
5955 <tag/Availability/ISO 9899
5957 <ref id="strqtok" name="strqtok">,
5958 <ref id="strspn" name="strspn">,
5959 <ref id="strstr" name="strstr">,
5960 <ref id="strtok" name="strtok">
5966 <sect1>strdup<label id="strdup"><p>
5970 <tag/Function/Allocate a copy of a string on the heap.
5971 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5972 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
5973 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
5974 to hold a copy of <tt/s/ including the terminating zero. If the allocation
5975 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
5976 memory block, and a pointer to the block is returned.
5977 <tag/Notes/<itemize>
5978 <item>The function is only available as fastcall function, so it may only
5979 be used in presence of a prototype.
5980 <item>It is up to the caller to free the allocated memory block.
5982 <tag/Availability/ISO 9899
5984 <ref id="free" name="free">,
5985 <ref id="malloc" name="malloc">
5991 <sect1>strerror<label id="strerror"><p>
5995 <tag/Function/Return a string describing an error code.
5996 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5997 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
5998 <tag/Description/The <tt/strerror/ function returns a string describing the
5999 given error code. If an invalid error code is passed, the string "Unknown
6000 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6001 <tt/errno/ is left untouched.
6002 <tag/Notes/<itemize>
6003 <item>The function is only available as fastcall function, so it may only
6004 be used in presence of a prototype.
6005 <item>While the return type of the function is a <tt/char*/, the returned
6006 string must not be modified by the caller!
6008 <tag/Availability/ISO 9899
6010 <ref id="_stroserror" name="_stroserror">
6016 <sect1>stricmp<label id="stricmp"><p>
6020 <tag/Function/Compare two strings case insensitive.
6021 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6022 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6023 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6024 parameters without case sensitivity. It returns a value that is less than zero
6025 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6026 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6027 <tag/Notes/<itemize>
6028 <item>The function is only available as fastcall function, so it may only
6029 be used in presence of a prototype.
6030 <item>The function is not available in strict ANSI mode.
6032 <tag/Availability/cc65
6034 <ref id="strcasecmp" name="strcasecmp">,
6035 <ref id="strcmp" name="strcmp">,
6036 <ref id="strcoll" name="strcoll">,
6037 <ref id="strncmp" name="strncmp">,
6038 <ref id="strxfrm" name="strxfrm">
6044 <sect1>strlen<label id="strlen"><p>
6048 <tag/Function/Return the length of a string.
6049 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6050 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6051 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6052 string to which s points, not including the terminating null byte.
6053 <tag/Notes/<itemize>
6054 <item>The function is only available as fastcall function, so it may only
6055 be used in presence of a prototype.
6056 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6057 function does not work correctly for strings with more than 255 characters.
6059 <tag/Availability/ISO 9899
6061 <ref id="strcpy" name="strcpy">
6067 <sect1>strlower<label id="strlower"><p>
6071 <tag/Function/Make a string lower case.
6072 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6073 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6074 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6075 function to each character of a string. The function will always return <tt/s/.
6076 <tag/Notes/<itemize>
6077 <item>The function is only available as fastcall function, so it may only
6078 be used in presence of a prototype.
6079 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6080 <item>An alias name for this function is <tt/strlwr/.
6082 <tag/Availability/cc65
6084 <ref id="strupper" name="strupper">,
6085 <ref id="tolower" name="tolower">
6091 <sect1>strlwr<label id="strlwr"><p>
6098 <sect1>strncat<label id="strncat"><p>
6102 <tag/Function/Concatentate two strings.
6103 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6104 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6105 <tag/Description/The <tt/strncat/ function appends not more than n characters
6106 of the string pointed to by s2 to the end of the string pointed to by s1. The
6107 terminating null character at the end of s1 is overwritten. A terminating null
6108 character is appended to the result, even if not all of s2 is appended to s1.
6109 <tag/Notes/<itemize>
6110 <item>The function is only available as fastcall function, so it may only
6111 be used in presence of a prototype.
6112 <item>If copying takes place between objects that overlap, the behaviour
6115 <tag/Availability/ISO 9899
6117 <ref id="strcpy" name="strcpy">,
6118 <ref id="strncat" name="strncat">,
6119 <ref id="strncpy" name="strncpy">
6125 <sect1>strncmp<label id="strncmp"><p>
6129 <tag/Function/Compare two strings.
6130 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6131 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6132 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6133 characters of the two strings passed as parameters. It returns a value that is
6134 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6135 <tt/s2/, zero if they are identical, and a value greater than zero they are
6137 <tag/Notes/<itemize>
6138 <item>The function is only available as fastcall function, so it may only
6139 be used in presence of a prototype.
6141 <tag/Availability/ISO 9899
6143 <ref id="strcasecmp" name="strcasecmp">,
6144 <ref id="strcmp" name="strcmp">,
6145 <ref id="strcoll" name="strcoll">,
6146 <ref id="stricmp" name="stricmp">,
6147 <ref id="strxfrm" name="strxfrm">
6153 <sect1>strncpy<label id="strncpy"><p>
6157 <tag/Function/Copy part of a string.
6158 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6159 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6160 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6161 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6162 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6163 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6164 written. The function always will return <tt/s1/.
6165 <tag/Notes/<itemize>
6166 <item>The function is available only as a fastcall function; so, it may be used
6167 only in the presence of a prototype.
6168 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6169 to by <tt/s2/, the result is <em/not/ null-terminated!
6170 <item>If copying takes place between objects that overlap, the behaviour is
6173 <tag/Availability/ISO 9899
6175 <ref id="memcpy" name="memcpy">,
6176 <ref id="strcat" name="strcat">,
6177 <ref id="strcpy" name="strcpy">,
6178 <ref id="strncat" name="strncat">
6183 static char hello[6];
6185 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6191 <sect1>strqtok<label id="strqtok"><p>
6195 <tag/Function/Break a string into tokens.
6196 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6197 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6198 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6199 tokens, which are delimited by either quotation marks or characters from the
6200 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6201 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6202 pointer to the first token in the string <tt/s1/. The following calls must pass
6203 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6204 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6205 <tag/Notes/<itemize>
6206 <item>The function is available only as a fastcall function; so, it may be used
6207 only in the presence of a prototype.
6208 <item><tt/strqtok()/ will modify the string <tt/s1/.
6209 <item>The function will forget where it is in the <tt/s1/ string if it is given
6210 a second <tt/s1/ string before it finishes the first one.
6212 <tag/Availability/cc65
6214 <ref id="strcspn" name="strcspn">,
6215 <!-- <ref id="strpbrk" name="strpbrk">, -->
6216 <ref id="strspn" name="strspn">,
6217 <ref id="strtok" name="strtok">
6223 <sect1>strrchr<label id="strrchr"><p>
6227 <tag/Function/Search for a character in a string.
6228 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6229 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6230 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6231 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6232 byte is considered to be part of the string. Upon completion, the function
6233 returns a pointer to the byte, or a null pointer if the byte was not found.
6234 <tag/Notes/<itemize>
6235 <item>The function is only available as fastcall function, so it may only
6236 be used in presence of a prototype.
6238 <tag/Availability/ISO 9899
6240 <ref id="strchr" name="strchr">
6246 <sect1>strspn<label id="strspn"><p>
6250 <tag/Function/Compute the length of a substring.
6251 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6252 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6253 <tag/Description/The <tt/strspn/ function computes and returns the length of
6254 the substring pointed to by <tt/s/ which does consist only of characters
6255 contained in the string <tt/set/.
6256 <tag/Notes/<itemize>
6257 <item>The function is only available as fastcall function, so it may only
6258 be used in presence of a prototype.
6260 <tag/Availability/ISO 9899
6262 <ref id="strcspn" name="strcspn">,
6263 <ref id="strstr" name="strstr">
6269 <sect1>strstr<label id="strstr"><p>
6273 <tag/Function/Find a substring.
6274 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6275 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6276 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6277 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6278 otherwise it returns <tt/NULL/.
6279 <tag/Notes/<itemize>
6280 <item>The function is only available as fastcall function, so it may only
6281 be used in presence of a prototype.
6283 <tag/Availability/ISO 9899
6285 <ref id="strcspn" name="strcspn">,
6286 <ref id="strspn" name="strspn">
6292 <sect1>strtok<label id="strtok"><p>
6296 <tag/Function/Break a string into tokens.
6297 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6298 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6299 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6300 tokens, which are delimited by characters from the string <tt/s2/. The first call
6301 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6302 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6303 the next token in the string. Different sets of delimiters may be used for the
6304 subsequent calls to <tt/strtok()/.
6305 <tag/Notes/<itemize>
6306 <item>The function is only available as fastcall function, so it may only
6307 be used in presence of a prototype.
6308 <item><tt/strtok()/ will modify the string <tt/s1/.
6309 <item>The function will forget where it is in the <tt/s1/ string if it is given
6310 a second <tt/s1/ string before it finishes the first one.
6312 <tag/Availability/ISO 9899
6314 <ref id="strcspn" name="strcspn">,
6315 <!-- <ref id="strpbrk" name="strpbrk">, -->
6316 <ref id="strqtok" name="strqtok">,
6317 <ref id="strspn" name="strspn">
6323 <sect1>strxfrm<label id="strxfrm"><p>
6327 <tag/Function/Transform a string.
6328 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6329 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6330 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6331 s2 and places the resulting string into the string pointed to by s1. The
6332 transformation is such that if the <tt/strcmp/ function is applied to two
6333 transformed strings, it returns a value greater than, equal to, or less than
6334 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6335 same two original strings. No more than n characters are placed into the
6336 resulting array pointed to by s1, including the terminating null character.
6337 <tag/Notes/<itemize>
6338 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6339 the behaviour is undefined.
6340 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6341 <item>The function is only available as fastcall function, so it may only
6342 be used in presence of a prototype.
6343 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6344 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6346 <tag/Availability/ISO 9899
6348 <ref id="strcmp" name="strcmp">,
6349 <ref id="strcoll" name="strcoll">,
6350 <ref id="strncpy" name="strncpy">
6356 <sect1>strupper<label id="strupper"><p>
6360 <tag/Function/Make a string upper case.
6361 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6362 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6363 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6364 function to each character of a string. The function will always return <tt/s/.
6365 <tag/Notes/<itemize>
6366 <item>The function is only available as fastcall function, so it may only
6367 be used in presence of a prototype.
6368 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6369 <item>An alias name for this function is <tt/strupr/.
6371 <tag/Availability/cc65
6373 <ref id="strlower" name="strlower">
6374 <ref id="toupper" name="toupper">
6380 <sect1>strupr<label id="strupr"><p>
6387 <sect1>telldir<label id="telldir"><p>
6391 <tag/Function/Return the current position of a directory stream.
6392 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6393 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6394 <tag/Description/<tt/telldir/ returns the current position of a directory
6395 stream. The return value may be used in subsequent calls to
6396 <tt/<ref id="seekdir" name="seekdir">/.
6397 <tag/Notes/<itemize>
6398 <item>The function is only available as fastcall function, so it may only
6399 be used in presence of a prototype.
6401 <tag/Availability/POSIX 1003.1
6403 <ref id="seekdir" name="seekdir">,
6404 <ref id="telldir" name="telldir">
6410 <sect1>textcolor<label id="textcolor"><p>
6414 <tag/Function/Set the text color.
6415 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6416 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6417 <tag/Description/The function will set a new text color. It returns the old
6418 (current) text color. Text output using any <tt/conio.h/ function will use
6419 the color set by this function.
6420 <tag/Notes/<itemize>
6421 <item>Text colors are system dependent. The function may have no effect
6422 on systems where the text color cannot be changed.
6423 <item>The function is only available as fastcall function, so it may only
6424 be used in presence of a prototype.
6426 <tag/Availability/cc65
6428 <ref id="bgcolor" name="bgcolor">,
6429 <ref id="bordercolor" name="bordercolor">
6435 <sect1>tgi_arc<label id="tgi_arc"><p>
6439 <tag/Function/Draw an elliptic arc in the current color.
6440 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6441 <tag/Declaration/<tt/void __fastcall__ tgi_arc (int x, int y,
6442 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
6443 <tag/Description/The function draws an elliptic arc with center at x/y and
6444 radii rx/ry using the current drawing color. The arc covers the angle
6445 between sa and ea (startangle and endangle), which must be in the range
6447 <tag/Notes/<itemize>
6448 <item>The function is only available as fastcall function, so it may only
6449 be used in presence of a prototype.
6450 <item>The function behaves unexpectedly or may crash if the angles are out
6453 <tag/Availability/cc65
6455 <ref id="tgi_bar" name="tgi_bar">,
6456 <ref id="tgi_circle" name="tgi_circle">,
6457 <ref id="tgi_ellipse" name="tgi_ellipse">,
6458 <ref id="tgi_pieslice" name="tgi_pieslice">,
6459 <ref id="tgi_setcolor" name="tgi_setcolor">
6461 /* Draw the upper half of an ellipse */
6462 tgi_setcolor(TGI_COLOR_BLUE);
6463 tgi_arc (50, 50, 40, 20, 0, 180);
6469 <sect1>tgi_bar<label id="tgi_bar"><p>
6473 <tag/Function/The function fills a rectangle on the drawpage with the current
6475 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6476 <tag/Declaration/<tt/void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);/
6477 <tag/Description/The function fills a rectangle on the drawpage with the current
6479 <tag/Notes/<itemize>
6480 <item>The function is only available as fastcall function, so it may only
6481 be used in presence of a prototype.
6483 <tag/Availability/cc65
6484 <tag/See also/Other tgi function
6486 tgi_setcolor(TGI_COLOR_GREEN);
6487 tgi_bar(10, 10, 100, 60);
6493 <sect1>tgi_circle<label id="tgi_circle"><p>
6497 <tag/Function/The function draws a circle in the current color.
6498 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6499 <tag/Declaration/<tt/void __fastcall__ tgi_circle (int x, int y, unsigned char radius);/
6500 <tag/Description/The function draws a circle in the current color.
6501 <tag/Notes/<itemize>
6502 <item>The function is only available as fastcall function, so it may only
6503 be used in presence of a prototype.
6505 <tag/Availability/cc65
6507 <ref id="tgi_arc" name="tgi_arc">,
6508 <ref id="tgi_bar" name="tgi_bar">,
6509 <ref id="tgi_ellipse" name="tgi_ellipse">,
6510 <ref id="tgi_pieslice" name="tgi_pieslice">,
6511 <ref id="tgi_setcolor" name="tgi_setcolor">
6513 tgi_setcolor(TGI_COLOR_BLACK);
6514 tgi_circle(50, 40, 40);
6520 <sect1>tgi_clear<label id="tgi_clear"><p>
6524 <tag/Function/Clear the drawpage
6525 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6526 <tag/Declaration/<tt/void tgi_clear (void);/
6527 <tag/Description/Clear the drawpage
6528 <tag/Availability/cc65
6529 <tag/See also/Other tgi functions
6535 <sect1>tgi_done<label id="tgi_done"><p>
6539 <tag/Function/End graphics mode, switch back to text mode.
6540 Will NOT uninstall or unload the driver!
6541 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6542 <tag/Declaration/<tt/void tgi_done (void);/
6543 <tag/Description/End graphics mode, switch back to text mode.
6544 Will NOT uninstall or unload the driver!
6545 <tag/Availability/cc65
6546 <tag/See also/Other tgi functions
6552 <sect1>tgi_ellipse<label id="tgi_ellipse"><p>
6556 <tag/Function/The function draws an ellipse in the current color.
6557 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6558 <tag/Declaration/<tt/void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);/
6559 <tag/Description/The function draws an ellipse at position x/y with radii
6560 rx and ry, using the current drawing color.
6561 <tag/Notes/<itemize>
6562 <item>The function is only available as fastcall function, so it may only
6563 be used in presence of a prototype.
6565 <tag/Availability/cc65
6567 <ref id="tgi_arc" name="tgi_arc">,
6568 <ref id="tgi_bar" name="tgi_bar">,
6569 <ref id="tgi_circle" name="tgi_circle">,
6570 <ref id="tgi_pieslice" name="tgi_pieslice">,
6571 <ref id="tgi_setcolor" name="tgi_setcolor">
6573 tgi_setcolor(TGI_COLOR_RED);
6574 tgi_ellipse (50, 40, 40, 20);
6580 <sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p>
6584 <tag/Function/Free a vector font that was previously loaded into memory.
6585 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6586 <tag/Declaration/<tt/void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);/
6587 <tag/Description/Free a vector font that was previously loaded into memory.
6588 <tag/Notes/<itemize>
6589 <item>The function is only available as fastcall function, so it may only
6590 be used in presence of a prototype.
6592 <tag/Availability/cc65
6594 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6595 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
6601 <sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p>
6603 <quote> <descrip> <tag/Function/Return the pixel aspect ratio.
6604 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6605 <tag/Declaration/<tt/unsigned tgi_getaspectratio (void);/
6606 <tag/Description/The function returns the pixel aspect ratio for the current
6607 driver and display as an 8.8 fixed point value. It may be used to correct
6608 geometric shapes so they look correct on the display. As an example, a circle
6609 with a radius of 100 pixels may look elliptic on some driver/display
6610 combinations if the aspect ratio is not 1.00.
6611 <tag/Notes/<itemize>
6612 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
6613 monitor for the given platform. The aspect ratio may be wrong if another
6615 <item>No TGI function will use the aspect ratio. It is up to the programmer to
6617 <item>The <ref id="tgi_setaspectratio" name="tgi_setaspectratio"> function can
6618 be used to change the aspect ratio for a loaded driver. The value is not reset
6619 by <ref id="tgi_init" name="tgi_init">, so if a driver is linked statically to
6620 an application, switching into and out of graphics mode will not restore the
6621 original aspect ratio.
6623 <tag/Availability/cc65
6625 <ref id="tgi_setaspectratio" name="tgi_setaspectratio">
6631 <sect1>tgi_getcolor<label id="tgi_getcolor"><p>
6635 <tag/Function/Return the current drawing color.
6636 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6637 <tag/Declaration/<tt/unsigned char tgi_getcolor (void);/
6638 <tag/Description/The actual color is an index to a palette. During tgi_init
6639 you will get a default palette. The number of colors depend on the platform.
6640 All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some
6641 platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN
6642 and then you change the green of the palette to blue using tgi_setpalette then
6643 after this painting in TGI_COLOR_GREEN will actually be blue.
6644 <tag/Availability/cc65
6645 <tag/See also/Other tgi functions
6647 color = tgi_getcolor();
6653 <sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p>
6657 <tag/Function/Get the number of available colors.
6658 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6659 <tag/Declaration/<tt/unsigned char tgi_getcolorcount (void);/
6660 <tag/Description/Tgi platforms use indexed color palettes. This function
6661 returns the number of entries we can use in the palette.
6662 <tag/Availability/cc65
6663 <tag/See also/Other tgi functions
6665 if (tgi_getcolorcount() == 2) {
6666 printf("Only monochrome graphics is supported\n");
6673 <sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p>
6677 <tag/Function/Get the palette installed by default.
6678 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6679 <tag/Declaration/<tt/const unsigned char* tgi_getdefpalette (void);/
6680 <tag/Description/The tgi driver has a default palette that is active at startup.
6681 The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this
6682 palette to work correctly.
6683 <tag/Availability/cc65
6684 <tag/See also/Other tgi functions
6690 <sect1>tgi_geterror<label id="tgi_geterror"><p>
6694 <tag/Function/Return the error code for the last operation.
6695 This will also clear the error.
6696 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6697 <tag/Declaration/<tt/unsigned char tgi_geterror (void);/
6698 <tag/Description/Return the error code for the last operation.
6699 This will also clear the error.
6700 <tag/Availability/cc65
6701 <tag/See also/Other tgi functions
6707 <sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p>
6711 <tag/Function/Get an error message describing the error.
6712 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6713 <tag/Declaration/<tt/const char* __fastcall__ tgi_geterrormsg (unsigned char code);/
6714 <tag/Description/Get an error message describing the error.
6715 <tag/Notes/<itemize>
6716 <item>The function is only available as fastcall function, so it may only
6717 be used in presence of a prototype.
6719 <tag/Availability/cc65
6720 <tag/See also/Other tgi functions
6726 <sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p>
6730 <tag/Function/Get the highest index of the palette.
6731 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6732 <tag/Declaration/<tt/unsigned char tgi_getmaxcolor (void);/
6733 <tag/Description/Get the highest index of the palette.
6734 <tag/Availability/cc65
6735 <tag/See also/Other tgi functions
6741 <sect1>tgi_getmaxx<label id="tgi_getmaxx"><p>
6745 <tag/Function/Get the maximum x coordinate that can be used on this screen.
6746 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6747 <tag/Declaration/<tt/unsigned tgi_getmaxx (void);/
6748 <tag/Description/Get the maximum x coordinate that can be used on this screen.
6749 <tag/Availability/cc65
6750 <tag/See also/Other tgi functions
6756 <sect1>tgi_getmaxy<label id="tgi_getmaxy"><p>
6760 <tag/Function/Get the maximum y coordinate that can be used on this screen.
6761 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6762 <tag/Declaration/<tt/unsigned tgi_getmaxy (void);/
6763 <tag/Description/Get the maximum y coordinate that can be used on this screen.
6764 <tag/Availability/cc65
6765 <tag/See also/Other tgi functions
6771 <sect1>tgi_getpagecount<label id="tgi_getpagecount"><p>
6775 <tag/Function/Return the number of screen pages available.
6776 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6777 <tag/Declaration/<tt/unsigned tgi_getpagecount (void);/
6778 <tag/Description/Return the number of screen pages available.
6779 <tag/Availability/cc65
6781 <ref id="tgi_setdrawpage" name="tgi_setdrawpage">,
6782 <ref id="tgi_setviewpage" name="tgi_setviewpage">
6788 <sect1>tgi_getpalette<label id="tgi_getpalette"><p>
6792 <tag/Function/Get the palette installed.
6793 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6794 <tag/Declaration/<tt/const unsigned char* tgi_getpalette (void);/
6795 <tag/Description/Get the palette installed.
6796 <tag/Availability/cc65
6797 <tag/See also/Other tgi functions
6803 <sect1>tgi_getpixel<label id="tgi_getpixel"><p>
6807 <tag/Function/Get the color of a pixel from the viewpage.
6808 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6809 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/
6810 <tag/Description/Get the color of a pixel from the viewpage.
6811 <tag/Notes/<itemize>
6812 <item>The function is only available as fastcall function, so it may only
6813 be used in presence of a prototype.
6815 <tag/Availability/cc65
6816 <tag/See also/Other tgi functions.
6822 <sect1>tgi_getxres<label id="tgi_getxres"><p>
6826 <tag/Function/Get number of horisontal pixels on the screen.
6827 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6828 <tag/Declaration/<tt/unsigned tgi_getxres (void);/
6829 <tag/Description/Get number of horisontal pixels on the screen.
6830 This is same as tgi_maxx()+1.
6831 <tag/Availability/cc65
6832 <tag/See also/Other tgi functions.
6838 <sect1>tgi_getyres<label id="tgi_getyres"><p>
6842 <tag/Function/Get number of vertical pixels on the screen.
6843 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6844 <tag/Declaration/<tt/unsigned tgi_getyres (void);/
6845 <tag/Description/Get number of vertical pixels on the screen.
6846 This is same as tgi_maxy()+1.
6847 <tag/Availability/cc65
6848 <tag/See also/Other tgi functions.
6854 <sect1>tgi_gotoxy<label id="tgi_gotoxy"><p>
6858 <tag/Function/Set graphics cursor at x, y.
6859 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6860 <tag/Declaration/<tt/void __fastcall__ tgi_gotoxy (int x, int y);/
6861 <tag/Description/Set graphics cursor at x, y.
6862 <tag/Notes/<itemize>
6863 <item>The function is only available as fastcall function, so it may only
6864 be used in presence of a prototype.
6866 <tag/Availability/cc65
6867 <tag/See also/Other tgi functions.
6873 <sect1>tgi_init<label id="tgi_init"><p>
6877 <tag/Function/Initialize the already loaded graphics driver.
6878 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6879 <tag/Declaration/<tt/void tgi_init (void);/
6880 <tag/Description/The tgi_init function will set the default palette to the
6882 <tag/Notes/<itemize>
6883 <item><tt/tgi_init/ will not clear the screen. This allows switching between
6884 text and graphics mode on platforms that have separate memory areas for the
6885 screens. If you want the screen cleared, call <tt/<ref id="tgi_clear"
6886 name="tgi_clear">/ after <tt/tgi_init/.
6888 <tag/Availability/cc65
6889 <tag/See also/Other tgi functions.
6891 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6892 tgi_init(); //Set up the default palette and clear the screen.
6898 <sect1>tgi_install<label id="tgi_install"><p>
6902 <tag/Function/Install an already loaded driver and return an error code.
6903 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6904 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_install (void* driver);/
6905 <tag/Description/The function installs a driver that was already loaded into
6906 memory (or linked statically to the program). It returns an error code
6907 (<tt/TGI_ERR_OK/ in case of success).
6908 <tag/Notes/<itemize>
6909 <item>The function is only available as fastcall function, so it may only be
6910 used in presence of a prototype.
6912 <tag/Availability/cc65
6914 <ref id="tgi_load_driver" name="tgi_load_driver">,
6915 <ref id="tgi_uninstall" name="tgi_uninstall">,
6916 <ref id="tgi_unload" name="tgi_unload">
6918 tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
6919 tgi_init(); //Set up the default palette and clear the screen.
6925 <sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p>
6929 <tag/Function/Install an already loaded driver and return an error code.
6930 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6931 <tag/Declaration/<tt/void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);/
6933 Install a vector font for use. More than one vector font can be loaded,
6934 but only one can be active. This function is used to tell which one. Call
6935 with a NULL pointer to uninstall the currently installed font.
6936 <tag/Notes/<itemize>
6937 <item>The function is only available as fastcall function, so it may only be
6938 used in presence of a prototype.
6940 <tag/Availability/cc65
6942 <ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
6943 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
6949 <sect1>tgi_ioctl<label id="tgi_ioctl"><p>
6953 <tag/Function/Platform dependent code extensions.
6954 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6955 <tag/Declaration/<tt/unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);/
6956 <tag/Description/Some platforms have extra display hardware that is not
6957 supported by standard tgi functions. You can extend the driver to support
6958 this extra hardware using tgi_ioctl functions.
6959 <tag/Notes/<itemize>
6960 <item>The function is only available as fastcall function, so it may only
6961 be used in presence of a prototype.
6962 <item>These functions are not easily portable to other cc65 platforms.
6964 <tag/Availability/cc65
6965 <tag/See also/Other tgi functions.
6967 #define tgi_sprite(spr) tgi_ioctl(0, (void*)(spr))
6968 #define tgi_flip() tgi_ioctl(1, (void*)0)
6969 #define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
6970 #define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
6971 #define tgi_busy() tgi_ioctl(4, (void*)0)
6972 #define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
6974 tgi_sprite(&background);
6975 tgi_setcolor(TGI_COLOR_BLUE);
6976 tgi_outttextxy(20,40,"Hello World");
6977 tgi_updatedisplay();
6984 <sect1>tgi_line<label id="tgi_line"><p>
6988 <tag/Function/Draw a line in the current drawing color.
6989 The graphics cursor will be set to x2/y2 by this call.
6990 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6991 <tag/Declaration/<tt/void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);/
6992 <tag/Description/Draw a line in the current drawing color.
6993 The graphics cursor will be set to x2/y2 by this call.
6994 <tag/Notes/<itemize>
6995 <item>The function is only available as fastcall function, so it may only
6996 be used in presence of a prototype.
6998 <tag/Availability/cc65
6999 <tag/See also/Other tgi functions.
7005 <sect1>tgi_lineto<label id="tgi_lineto"><p>
7009 <tag/Function/Draw a line in the current drawing color from the graphics
7010 cursor to the new end point. The graphics cursor will be updated to x2/y2.
7011 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7012 <tag/Declaration/<tt/void __fastcall__ tgi_lineto (int x2, int y2);/
7013 <tag/Description/Draw a line in the current drawing color from the graphics
7014 cursor to the new end point. The graphics cursor will be updated to x2/y2.
7015 <tag/Notes/<itemize>
7016 <item>The function is only available as fastcall function, so it may only
7017 be used in presence of a prototype.
7019 <tag/Availability/cc65
7020 <tag/See also/Other tgi functions.
7026 <sect1>tgi_load_driver<label id="tgi_load_driver"><p>
7030 <tag/Function/Load and install the given driver.
7031 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7032 <tag/Declaration/<tt/void __fastcall__ tgi_load_driver (const char *name);/
7033 <tag/Description/Load and install the driver by name.
7034 Will just load the driver and check if loading was successful.
7035 Will not switch to graphics mode.
7036 <tag/Notes/<itemize>
7037 <item>The function is only available as fastcall function, so it may only
7038 be used in presence of a prototype.
7040 <tag/Availability/cc65
7041 <tag/See also/Other tgi functions.
7047 <sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p>
7051 <tag/Function/Load the given vector font.
7052 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7053 <tag/Declaration/<tt/const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);/
7055 Load a vector font into memory and return it. In case of errors, NULL is
7056 returned and an error is set, which can be retrieved using tgi_geterror.
7057 To use the font, it has to be installed using tgi_install_vectorfont.
7058 <tag/Notes/<itemize>
7059 <item>The function is only available as fastcall function, so it may only
7060 be used in presence of a prototype.
7062 <tag/Availability/cc65
7064 <ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">,
7065 <ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
7071 <sect1>tgi_outtext<label id="tgi_outtext"><p>
7075 <tag/Function/Output text at the current graphics cursor position.
7076 The graphics cursor is moved to the end of the text.
7077 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7078 <tag/Declaration/<tt/void __fastcall__ tgi_outtext (const char* s);/
7079 <tag/Description/Output text at the current graphics cursor position.
7080 The graphics cursor is moved to the end of the text.
7081 <tag/Notes/<itemize>
7082 <item>The function is only available as fastcall function, so it may only
7083 be used in presence of a prototype.
7085 <tag/Availability/cc65
7086 <tag/See also/Other tgi functions.
7092 <sect1>tgi_outtextxy<label id="tgi_outtextxy"><p>
7096 <tag/Function/Output text at the given cursor position.
7097 The graphics cursor is moved to the end of the text.
7098 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7099 <tag/Declaration/<tt/void __fastcall__ tgi_outtextxy (int x, int y, const char* s);/
7100 <tag/Description/Output text at the given cursor position.
7101 The graphics cursor is moved to the end of the text.
7102 <tag/Notes/<itemize>
7103 <item>The function is only available as fastcall function, so it may only
7104 be used in presence of a prototype.
7106 <tag/Availability/cc65
7107 <tag/See also/Other tgi functions.
7113 <sect1>tgi_pieslice<label id="tgi_pieslice"><p>
7117 <tag/Function/Draw an elliptic pie slice in the current color.
7118 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7119 <tag/Declaration/<tt/void __fastcall__ tgi_pie slice (int x, int y,
7120 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
7121 <tag/Description/The function draws an elliptic pie slice with center at x/y
7122 and radii rx/ry using the current drawing color. The pie slice covers the angle
7123 between sa and ea (startangle and endangle), which must be in the range
7125 <tag/Notes/<itemize>
7126 <item>The function is only available as fastcall function, so it may only
7127 be used in presence of a prototype.
7128 <item>The function behaves unexpectedly or may crash if the angles are out
7131 <tag/Availability/cc65
7133 <ref id="tgi_bar" name="tgi_arc">,
7134 <ref id="tgi_bar" name="tgi_bar">,
7135 <ref id="tgi_circle" name="tgi_circle">,
7136 <ref id="tgi_ellipse" name="tgi_ellipse">,
7137 <ref id="tgi_setcolor" name="tgi_setcolor">
7139 /* Draw the closed upper half of an ellipse */
7140 tgi_setcolor(TGI_COLOR_BLUE);
7141 tgi_pieslice (50, 50, 40, 20, 0, 180);
7147 <sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p>
7149 <quote> <descrip> <tag/Function/Set the pixel aspect ratio.
7150 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7151 <tag/Declaration/<tt/void __fastcall__ tgi_setaspectratio (unsigned ratio);/
7152 <tag/Description/The function sets the pixel aspect ratio for the current
7153 driver and display. The argument is an 8.8 fixed point value. The aspect ratio
7154 may be used to correct geometric shapes so they look correct on a given
7155 display. As an example, a circle with a radius of 100 pixels may look elliptic
7156 on some driver/display combinations if the aspect ratio is not 1.00.
7157 <tag/Notes/<itemize>
7158 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
7159 monitor for the given platform. The aspect ratio may be wrong if another
7161 <item>No TGI function will use the aspect ratio. It is up to the programmer to
7163 <item>The <tt/tgi_setaspectratio/ function can be used to change the aspect
7164 ratio for a loaded driver. The value is not reset by <ref id="tgi_init"
7165 name="tgi_init">, so if a driver is linked statically to an application,
7166 switching into and out of graphics mode will not restore the original aspect
7168 <item>The function is available only as a fastcall function; so, it may be used
7169 only in the presence of a prototype.
7171 <tag/Availability/cc65
7173 <ref id="tgi_getaspectratio" name="tgi_getaspectratio">
7179 <sect1>tgi_setcolor<label id="tgi_setcolor"><p>
7183 <tag/Function/Set color to be used in future draw operations.
7184 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7185 <tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/
7186 <tag/Description/Set color to be used in future draw operations.
7187 <tag/Notes/<itemize>
7188 <item>The function is only available as fastcall function, so it may only
7189 be used in presence of a prototype.
7191 <tag/Availability/cc65
7192 <tag/See also/Other tgi functions.
7194 tgi_setcolor(TGI_COLOR_BLACK);
7196 tgi_setcolor(TGI_COLOR_WHITE);
7197 tgi_bar(10,10,20,20);
7202 <sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p>
7206 <tag/Function/Set the page for drawing.
7207 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7208 <tag/Declaration/<tt/void __fastcall__ tgi_setdrawpage (unsigned char page);/
7209 <tag/Description/If the drawpage and the viewpage are the same then all drawing
7210 is seen immediately as it is drawn. For double buffered games you can set the
7211 drawpage to a different page than the viewpage. This lets you draw the next
7212 screen in the background and when the screen is ready you display it.
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.
7221 tgi_outtextxy(10, 10, "Hello World");
7222 tgi_setviewpage(1); // Show page 1
7224 tgi_outtextxy(10, 10, "Creating next frame");
7226 tgi_setviewpage(0); // Show page 0
7231 <sect1>tgi_setpalette<label id="tgi_setpalette"><p>
7235 <tag/Function/Set the palette (not available with all drivers/hardware).
7236 Palette is a pointer to as many entries as there are colors.
7237 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7238 <tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/
7239 <tag/Description/Set the palette (not available with all drivers/hardware).
7240 Palette is a pointer to as many entries as there are colors.
7241 <tag/Notes/<itemize>
7242 <item>The function is only available as fastcall function, so it may only
7243 be used in presence of a prototype.
7245 <tag/Availability/cc65
7246 <tag/See also/Other tgi functions.
7251 <sect1>tgi_setpixel<label id="tgi_setpixel"><p>
7255 <tag/Function/Plot a pixel on the drawpage with the current color.
7256 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7257 <tag/Declaration/<tt/void __fastcall__ tgi_setpixel (int x, int y);/
7258 <tag/Description/Plot a pixel on the drawpage with the current color.
7259 <tag/Notes/<itemize>
7260 <item>The function is only available as fastcall function, so it may only
7261 be used in presence of a prototype.
7263 <tag/Availability/cc65
7264 <tag/See also/Other tgi functions.
7269 <sect1>tgi_setviewpage<label id="tgi_setviewpage"><p>
7273 <tag/Function/Set page to be visible on screen.
7274 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7275 <tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/
7276 <tag/Description/If the drawpage and the viewpage are the same then all drawing
7277 is seen immediately as it is drawn. For double buffered games you can set the
7278 drawpage to a different page than the viewpage. This lets you draw the next
7279 screen in the background and when the screen is ready you display it.
7280 <tag/Notes/<itemize>
7281 <item>The function is only available as fastcall function, so it may only
7282 be used in presence of a prototype.
7284 <tag/Availability/cc65
7285 <tag/See also/Other tgi functions.
7288 tgi_outtextxy(10, 10, "Hello World");
7289 tgi_setviewpage(1); // Show page 1
7291 tgi_outtextxy(10, 10, "Creating next frame");
7293 tgi_setviewpage(0); // Show page 0
7298 <sect1>tgi_gettextheight<label id="tgi_gettextheight"><p>
7302 <tag/Function/Calculate the height of the text in pixels according to
7303 the current text style.
7304 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7305 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/
7306 <tag/Description/Calculate the height of the text in pixels according to
7307 the current text style.
7308 <tag/Notes/<itemize>
7309 <item>The function is only available as fastcall function, so it may only
7310 be used in presence of a prototype.
7312 <tag/Availability/cc65
7313 <tag/See also/Other tgi functions.
7318 <sect1>tgi_settextscale<label id="tgi_settextscale"><p>
7322 <tag/Function/Set the scaling for text output.
7323 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7324 <tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/
7326 Set the scaling for text output. The scaling factors for width and height
7327 are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
7328 <tag/Notes/<itemize>
7329 <item>The function is only available as fastcall function, so it may only
7330 be used in presence of a prototype.
7332 <tag/Availability/cc65
7334 <ref id="tgi_settextstyle" name="tgi_settextstyle">
7339 <sect1>tgi_settextstyle<label id="tgi_settextstyle"><p>
7343 <tag/Function/Set the style for text output.
7344 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7345 <tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/
7346 <tag/Description/Set the style for text output.
7347 <tag/Notes/<itemize>
7348 <item>The function is only available as fastcall function, so it may only
7349 be used in presence of a prototype.
7351 <tag/Availability/cc65
7353 <ref id="tgi_settextscale" name="tgi_settextscale">
7358 <sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p>
7362 <tag/Function/Calculate the width of the text in pixels according to the current text style.
7363 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7364 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/
7365 <tag/Description/Calculate the width of the text in pixels according to the current text style.
7366 <tag/Notes/<itemize>
7367 <item>The function is only available as fastcall function, so it may only
7368 be used in presence of a prototype.
7370 <tag/Availability/cc65
7371 <tag/See also/Other tgi functions.
7376 <sect1>tgi_uninstall<label id="tgi_uninstall"><p>
7380 <tag/Function/Uninstall the currently loaded driver but do not unload it.
7381 Will call tgi_done if necessary.
7382 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7383 <tag/Declaration/<tt/void tgi_uninstall (void);/
7384 <tag/Description/Uninstall the currently loaded driver but do not unload it.
7385 Will call tgi_done if necessary.
7386 <tag/Availability/cc65
7387 <tag/See also/Other tgi functions.
7392 <sect1>tgi_unload<label id="tgi_unload"><p>
7396 <tag/Function/Uninstall, then unload the currently loaded driver.
7397 Will call tgi_done if necessary.
7398 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
7399 <tag/Declaration/<tt/void tgi_unload (void);/
7400 <tag/Description/Uninstall, then unload the currently loaded driver.
7401 Will call tgi_done if necessary.
7402 <tag/Availability/cc65
7403 <tag/See also/Other tgi functions.
7408 <sect1>time<label id="time"><p>
7412 <tag/Function/Get the time.
7413 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7414 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7415 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7416 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7417 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7418 returned and <tt/errno/ is set to <tt/ENOSYS/.
7419 <tag/Notes/<itemize>
7420 <item>The function is only available as fastcall function, so it may
7421 only be used in presence of a prototype.
7422 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7423 returned value may not be valid.
7425 <tag/Availability/ISO 9899
7427 <ref id="clock" name="clock">
7433 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7437 <tag/Function/Toggle between 40 and 80 column mode.
7438 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7439 <tag/Declaration/<tt/void toggle_videomode (void);/
7440 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7441 old mode (cursor position, color and so on) are saved and restored together
7443 <tag/Notes/<itemize>
7444 <item>The function is specific to the C128.
7445 <item>This function is deprecated. Please use <ref id="videomode"
7446 name="videomode"> instead!
7448 <tag/Availability/C128
7450 <ref id="fast" name="fast">,
7451 <ref id="slow" name="slow">,
7452 <ref id="videomode" name="videomode">
7458 <sect1>tolower<label id="tolower"><p>
7462 <tag/Function/Convert a character into its lower case representation.
7463 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7464 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7465 <tag/Description/The function returns the given character converted to lower
7466 case. If the given character is not a letter, it is returned unchanged.
7467 <tag/Notes/<itemize>
7468 <item>The function is only available as fastcall function, so it may
7469 only be used in presence of a prototype.
7471 <tag/Availability/ISO 9899
7473 <ref id="islower" name="islower">,
7474 <ref id="isupper" name="isupper">,
7475 <ref id="toupper" name="toupper">
7481 <sect1>toupper<label id="toupper"><p>
7485 <tag/Function/Convert a character into its upper case representation.
7486 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7487 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7488 <tag/Description/The function returns the given character converted to upper
7489 case. If the given character is not a letter, it is returned unchanged.
7490 <tag/Notes/<itemize>
7491 <item>The function is only available as fastcall function, so it may
7492 only be used in presence of a prototype.
7494 <tag/Availability/ISO 9899
7496 <ref id="islower" name="islower">,
7497 <ref id="isupper" name="isupper">,
7498 <ref id="tolower" name="tolower">
7504 <sect1>ultoa<label id="ultoa"><p>
7508 <tag/Function/Convert an unsigned long integer into a string.
7509 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7510 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7511 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7512 string using <tt/radix/ as the base.
7513 <tag/Notes/<itemize>
7514 <item>There are no provisions to prevent a buffer overflow.
7515 <item>The function is non standard, so it is not available in strict ANSI mode.
7516 You should probably use <tt/sprintf/ instead.
7517 <item>The function is only available as fastcall function, so it may only be
7518 used in presence of a prototype.
7520 <tag/Availability/cc65
7522 <ref id="atoi" name="atoi">,
7523 <ref id="atol" name="atol">,
7524 <ref id="itoa" name="itoa">,
7525 <ref id="ltoa" name="ltoa">,
7526 <ref id="utoa" name="utoa">
7532 <sect1>unlink<label id="unlink"><p>
7536 <tag/Function/Delete a file.
7537 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7538 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7539 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7540 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7541 code describing the reason for the failure.
7542 <tag/Notes/<itemize>
7543 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7544 name="remove">/ instead, which is a native ANSI C function and does the same.
7545 <item>This function is not available on all cc65 targets (depends on the
7546 availability of file I/O).
7547 <item>The function is only available as fastcall function, so it may only
7548 be used in presence of a prototype.
7549 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7550 used, which has the same semantics, but is more portable, because it conforms
7551 to the ISO C standard.
7553 <tag/Availability/POSIX 1003.1
7555 <ref id="remove" name="remove">
7558 #include <stdio.h>
7559 #include <unistd.h>
7561 #define FILENAME "helloworld"
7563 if (unlink (FILENAME) == 0) {
7564 printf ("We deleted %s successfully\n", FILENAME);
7566 printf ("There was a problem deleting %s\n", FILENAME);
7573 <sect1>utoa<label id="utoa"><p>
7577 <tag/Function/Convert an unsigned integer into a string.
7578 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7579 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7580 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7581 using <tt/radix/ as the base.
7582 <tag/Notes/<itemize>
7583 <item>There are no provisions to prevent a buffer overflow.
7584 <item>The function is non standard, so it is not available in strict ANSI mode.
7585 You should probably use <tt/sprintf/ instead.
7586 <item>The function is only available as fastcall function, so it may only be
7587 used in presence of a prototype.
7589 <tag/Availability/cc65
7591 <ref id="atoi" name="atoi">,
7592 <ref id="atol" name="atol">,
7593 <ref id="itoa" name="itoa">,
7594 <ref id="ltoa" name="ltoa">,
7595 <ref id="ultoa" name="ultoa">
7601 <sect1>vcprintf<label id="vcprintf"><p>
7605 <tag/Function/Formatted output to the console.
7606 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7607 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7608 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7609 text where necessary and formatted according to the format string given. The
7610 resulting string is output to the console. <tt/vcprintf/ supports the same
7611 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7612 <tag/Notes/<itemize>
7613 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7614 between <tt/\r/ and <tt/\n/.
7615 <item>The function is only available as fastcall function, so it may only be
7616 used in presence of a prototype.
7618 <tag/Availability/cc65
7620 <ref id="cprintf" name="cprintf">,
7621 <ref id="cputc" name="cputc">,
7622 <ref id="cputcxy" name="cputcxy">,
7623 <ref id="cputs" name="cputs">,
7624 <ref id="cputsxy" name="cputsxy">
7630 <sect1>videomode<label id="videomode"><p>
7634 <tag/Function/Switch to either 40 or 80 column mode.
7635 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7636 <ref id="c128.h" name="c128.h">/
7637 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7638 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7639 the requested mode is already active, nothing happens. The old mode is returned
7641 <tag/Notes/<itemize>
7642 <item>The function is specific to the C128 and enhanced Apple //e.
7643 <item>This function replaces <ref id="toggle_videomode"
7644 name="toggle_videomode">.
7645 <item>The function is only available as fastcall function, so it may only be
7646 used in presence of a prototype.
7648 <tag/Availability/C128 and enhanced Apple //e
7650 <ref id="fast" name="fast">,
7651 <ref id="slow" name="slow">,
7652 <ref id="toggle_videomode" name="toggle_videomode">
7658 <sect1>wherex<label id="wherex"><p>
7662 <tag/Function/Return the current X position of the text mode cursor.
7663 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7664 <tag/Declaration/<tt/unsigned char wherex (void);/
7665 <tag/Description/The function returns the current X position of the text mode
7666 cursor. Zero is returned for the leftmost screen position.
7667 <tag/Availability/cc65
7669 <ref id="gotox" name="gotox">,
7670 <ref id="gotoy" name="gotoy">,
7671 <ref id="gotoxy" name="gotoxy">,
7672 <ref id="wherey" name="wherey">
7678 <sect1>wherey<label id="wherey"><p>
7682 <tag/Function/Return the current Y position of the text mode cursor.
7683 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7684 <tag/Declaration/<tt/unsigned char wherey (void);/
7685 <tag/Description/The function returns the current Y position of the text mode
7686 cursor. Zero is returned for the uppermost screen position.
7687 <tag/Availability/cc65
7689 <ref id="gotox" name="gotox">,
7690 <ref id="gotoy" name="gotoy">,
7691 <ref id="gotoxy" name="gotoxy">,
7692 <ref id="wherex" name="wherex">