]> git.sur5r.net Git - cc65/blob - doc/funcref.sgml
Fixed a typo.
[cc65] / doc / funcref.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4 <title>cc65 function reference
5 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
6 <date>07.11.2002
7
8 <abstract>
9 cc65 is a C compiler for 6502 based systems. This function reference describes
10 the C functions available in the standard library.
11 </abstract>
12
13 <!-- Table of contents -->
14 <toc>
15
16 <!-- Begin the document -->
17
18 <sect>Introduction<p>
19
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.
24
25 For an overview about the available libraries, their purpose, and any
26 differences to the ISO standard, please have a look at the <htmlurl
27 url="library.html" name="cc65 Library Overview">.
28
29 <bf/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.
32
33 Each entry for a function contains a detailed description
34
35 <quote>
36 <descrip>
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
40 function.
41 <tag/Description/Description of the function.
42 <tag/Limits/Limits.
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.
46 </descrip>
47 </quote>
48
49
50 <sect>Functions by header file<p>
51
52 <sect1><tt/6502.h/<label id="6502.h"><p>
53
54 <itemize>
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">
64 </itemize>
65
66
67 <sect1><tt/apple2.h/<label id="apple2.h"><p>
68
69 <itemize>
70 <item>_dos_type
71 <item><ref id="get_ostype" name="get_ostype">
72 <item>rebootafterexit
73 </itemize>
74
75
76 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
77
78 <itemize>
79 <item>_dos_type
80 <item><ref id="get_ostype" name="get_ostype">
81 <item>rebootafterexit
82 <item>textframe
83 <item>textframexy
84 <item><ref id="videomode" name="videomode">
85 </itemize>
86
87
88 <sect1><tt/assert.h/<label id="assert.h"><p>
89
90 <itemize>
91 <item><ref id="assert" name="assert">
92 </itemize>
93
94
95 <sect1><tt/atari.h/<label id="atari.h"><p>
96
97 <itemize>
98 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
99 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
100 <!-- <item><ref id="_graphics" name="_graphics"> -->
101 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
102 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
103 <!-- <item><ref id="_scroll" name="_scroll"> -->
104 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
105 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
106 <item><ref id="get_ostype" name="get_ostype">
107 <!-- <item><ref id="get_tv" name="get_tv"> -->
108 </itemize>
109
110 (incomplete)
111
112
113 <sect1><tt/atmos.h/<label id="atmos.h"><p>
114
115 (incomplete)
116
117
118 <sect1><tt/c128.h/<label id="c128.h"><p>
119
120 <itemize>
121 <item><ref id="c64mode" name="c64mode">
122 <item><ref id="fast" name="fast">
123 <item><ref id="slow" name="slow">
124 <item><ref id="toggle_videomode" name="toggle_videomode">
125 <item><ref id="videomode" name="videomode">
126 </itemize>
127
128
129 <sect1><tt/c16.h/<label id="c16.h"><p>
130
131 (incomplete)
132
133
134 <sect1><tt/c64.h/<label id="c64.h"><p>
135
136 <itemize>
137 <item><ref id="get_ostype" name="get_ostype">
138 </itemize>
139
140
141 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
142
143 <itemize>
144 <item><ref id="peekbsys" name="peekbsys">
145 <item><ref id="peekwsys" name="peekwsys">
146 <item><ref id="pokebsys" name="pokebsys">
147 <item><ref id="pokewsys" name="pokewsys">
148 </itemize>
149
150
151 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
152
153 <itemize>
154 <item><ref id="peekbsys" name="peekbsys">
155 <item><ref id="peekwsys" name="peekwsys">
156 <item><ref id="pokebsys" name="pokebsys">
157 <item><ref id="pokewsys" name="pokewsys">
158 </itemize>
159
160
161 <sect1><tt/cc65.h/<label id="cc65.h"><p>
162
163 <!-- <itemize> -->
164 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
165 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
166 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
167 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
168 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
169 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
170 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
171 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
172 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
173 <!-- </itemize> -->
174
175 (incomplete)
176
177
178 <sect1><tt/conio.h/<label id="conio.h"><p>
179
180 <itemize>
181 <item><ref id="bgcolor" name="bgcolor">
182 <item><ref id="bordercolor" name="bordercolor">
183 <item><ref id="cclear" name="cclear">
184 <item><ref id="cclearxy" name="cclearxy">
185 <item><ref id="cgetc" name="cgetc">
186 <item><ref id="chline" name="chline">
187 <item><ref id="chlinexy" name="chlinexy">
188 <item><ref id="clrscr" name="clrscr">
189 <item><ref id="cprintf" name="cprintf">
190 <item><ref id="cputc" name="cputc">
191 <item><ref id="cputcxy" name="cputcxy">
192 <item><ref id="cputs" name="cputs">
193 <item><ref id="cputsxy" name="cputsxy">
194 <item><ref id="cursor" name="cursor">
195 <item><ref id="cvline" name="cvline">
196 <item><ref id="cvlinexy" name="cvlinexy">
197 <item><ref id="gotox" name="gotox">
198 <item><ref id="gotoxy" name="gotoxy">
199 <item><ref id="gotoy" name="gotoy">
200 <item><ref id="kbhit" name="kbhit">
201 <item><ref id="revers" name="revers">
202 <item><ref id="screensize" name="screensize">
203 <item><ref id="textcolor" name="textcolor">
204 <item><ref id="vcprintf" name="vcprintf">
205 <item><ref id="wherex" name="wherex">
206 <item><ref id="wherey" name="wherey">
207 </itemize>
208
209
210 <sect1><tt/ctype.h/<label id="ctype.h"><p>
211
212 <itemize>
213 <item><ref id="isalnum" name="isalnum">
214 <item><ref id="isalpha" name="isalpha">
215 <item><ref id="isascii" name="isascii">
216 <item><ref id="isblank" name="isblank">
217 <item><ref id="iscntrl" name="iscntrl">
218 <item><ref id="isdigit" name="isdigit">
219 <item><ref id="isgraph" name="isgraph">
220 <item><ref id="islower" name="islower">
221 <item><ref id="isprint" name="isprint">
222 <item><ref id="ispunct" name="ispunct">
223 <item><ref id="isspace" name="isspace">
224 <item><ref id="isupper" name="isupper">
225 <item><ref id="isxdigit" name="isxdigit">
226 <item><ref id="tolower" name="tolower">
227 <item><ref id="toupper" name="toupper">
228 </itemize>
229
230
231 <sect1><tt/dbg.h/<label id="dbg.h"><p>
232
233 <!-- <itemize> -->
234 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
235 <!-- </itemize> -->
236
237 (incomplete)
238
239
240 <sect1><tt/dio.h/<label id="dio.h"><p>
241
242 <htmlurl url="dio.html" name="dio.html">
243 Low-level disk I/O API.
244
245
246 <sect1><tt/em.h/<label id="em.h"><p>
247
248 <itemize>
249 <item><ref id="em_commit" name="em_commit">
250 <item><ref id="em_copyfrom" name="em_copyfrom">
251 <item><ref id="em_copyto" name="em_copyto">
252 <item><ref id="em_install" name="em_install">
253 <item><ref id="em_load_driver" name="em_load_driver">
254 <item><ref id="em_map" name="em_map">
255 <item><ref id="em_pagecount" name="em_pagecount">
256 <item><ref id="em_uninstall" name="em_uninstall">
257 <item><ref id="em_unload" name="em_unload">
258 <item><ref id="em_use" name="em_use">
259 </itemize>
260
261
262 <sect1><tt/errno.h/<label id="errno.h"><p>
263
264 <!-- <itemize> -->
265 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
266 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
267 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
268 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
269 <!-- </itemize> -->
270
271 (incomplete)
272
273
274 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
275
276 <itemize>
277 <item><ref id="close" name="close">
278 <item><ref id="creat" name="creat">
279 <item><ref id="open" name="open">
280 </itemize>
281
282
283 <sect1><tt/geos.h/<label id="geos.h"><p>
284
285 (incomplete)
286
287
288 <sect1><tt/joystick.h/<label id="joystick.h"><p>
289
290 <itemize>
291 <item><ref id="joy_count" name="joy_count">
292 <item><ref id="joy_install" name="joy_install">
293 <item><ref id="joy_load_driver" name="joy_load_driver">
294 <item><ref id="joy_read" name="joy_read">
295 <item><ref id="joy_uninstall" name="joy_uninstall">
296 <item><ref id="joy_unload" name="joy_unload">
297 </itemize>
298
299
300 <sect1><tt/locale.h/<label id="locale.h"><p>
301
302 <itemize>
303 <item><ref id="localeconv" name="localeconv">
304 <item><ref id="setlocale" name="setlocale">
305 </itemize>
306
307
308 <sect1><tt/lynx.h/<label id="lynx.h"><p>
309
310 <!-- <itemize> -->
311 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
312 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
313 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
314 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
315 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
316 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
317 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
318 <!-- </itemize> -->
319
320 (incomplete)
321
322
323 <sect1><tt/modload.h/<label id="modload.h"><p>
324
325 <itemize>
326 <item><ref id="mod_load" name="mod_load">
327 <item><ref id="mod_free" name="mod_free">
328 </itemize>
329
330
331 <sect1><tt/mouse.h/<label id="mouse.h"><p>
332
333 <itemize>
334 <item><ref id="mouse_buttons" name="mouse_buttons">
335 <item><ref id="mouse_getbox" name="mouse_getbox">
336 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
337 <item><ref id="mouse_hide" name="mouse_hide">
338 <item><ref id="mouse_info" name="mouse_info">
339 <item><ref id="mouse_install" name="mouse_install">
340 <item><ref id="mouse_ioctl" name="mouse_ioctl">
341 <item><ref id="mouse_load_driver" name="mouse_load_driver">
342 <item><ref id="mouse_move" name="mouse_move">
343 <item><ref id="mouse_pos" name="mouse_pos">
344 <item><ref id="mouse_setbox" name="mouse_setbox">
345 <item><ref id="mouse_show" name="mouse_show">
346 <item><ref id="mouse_uninstall" name="mouse_uninstall">
347 <item><ref id="mouse_unload" name="mouse_unload">
348 </itemize>
349
350
351 <sect1><tt/nes.h/<label id="nes.h"><p>
352
353 <!-- <itemize> -->
354 <!-- <item><ref id="get_tv" name="get_tv"> -->
355 <!-- <item><ref id="waitvblank" name="waitvblank"> -->
356 <!-- </itemize> -->
357
358 (incomplete)
359
360
361 <sect1><tt/o65.h/<label id="o65.h"><p>
362
363 The <tt/o65.h/ header file contains structure and constant definitions that
364 may be used when dealing with files in <htmlurl
365 url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">.
366 It does not declare any functions.
367
368
369 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
370
371 <itemize>
372 <item><ref id="PEEK" name="PEEK">
373 <item><ref id="PEEKW" name="PEEKW">
374 <item><ref id="POKE" name="POKE">
375 <item><ref id="POKEW" name="POKEW">
376 </itemize>
377
378
379 <sect1><tt/pet.h/<label id="pet.h"><p>
380
381 (incomplete)
382
383
384 <sect1><tt/plus4.h/<label id="plus4.h"><p>
385
386 (incomplete)
387
388
389 <sect1><tt/serial.h/<label id="serial.h"><p>
390
391 The <tt/serial.h/ header file contains definitions for initializing serial
392 communication.
393
394 <itemize>
395 <item><ref id="ser_close" name="ser_close">
396 <item><ref id="ser_get" name="ser_get">
397 <item><ref id="ser_install" name="ser_install">
398 <item><ref id="ser_ioctl" name="ser_ioctl">
399 <item><ref id="ser_load_driver" name="ser_load_driver">
400 <item><ref id="ser_open" name="ser_open">
401 <item><ref id="ser_put" name="ser_put">
402 <item><ref id="ser_status" name="ser_status">
403 <item><ref id="ser_uninstall" name="ser_uninstall">
404 <item><ref id="ser_unload" name="ser_unload">
405 </itemize>
406
407
408 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
409
410 <itemize>
411 <item><ref id="setjmp" name="setjmp">
412 <item><ref id="longjmp" name="longjmp">
413 </itemize>
414
415
416 <sect1><tt/signal.h/<label id="signal.h"><p>
417
418 <itemize>
419 <item><ref id="raise" name="raise">
420 <item><ref id="signal" name="signal">
421 </itemize>
422
423
424 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
425
426 (incomplete)
427
428
429 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
430
431 (incomplete)
432
433
434 <sect1><tt/stddef.h/<label id="stddef.h"><p>
435
436 <itemize>
437 <item><ref id="offsetof" name="offsetof">
438 </itemize>
439
440
441 <sect1><tt/stdio.h/<label id="stdio.h"><p>
442
443 <itemize>
444 <item><ref id="_poserror" name="_poserror">
445 <item><ref id="clearerr" name="clearerr">
446 <!-- <item><ref id="fclose" name="fclose"> -->
447 <!-- <item><ref id="fdopen" name="fdopen"> -->
448 <item><ref id="feof" name="feof">
449 <item><ref id="ferror" name="ferror">
450 <!-- <item><ref id="fflush" name="fflush"> -->
451 <!-- <item><ref id="fgetc" name="fgetc"> -->
452 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
453 <!-- <item><ref id="fgets" name="fgets"> -->
454 <item><ref id="fileno" name="fileno">
455 <!-- <item><ref id="fopen" name="fopen"> -->
456 <!-- <item><ref id="fprintf" name="fprintf"> -->
457 <!-- <item><ref id="fputc" name="fputc"> -->
458 <!-- <item><ref id="fputs" name="fputs"> -->
459 <!-- <item><ref id="fread" name="fread"> -->
460 <!-- <item><ref id="freopen" name="freopen"> -->
461 <!-- <item><ref id="fscanf" name="fscanf"> -->
462 <!-- <item><ref id="fseek" name="fseek"> -->
463 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
464 <!-- <item><ref id="ftell" name="ftell"> -->
465 <!-- <item><ref id="fwrite" name="fwrite"> -->
466 <!-- <item><ref id="getc" name="getc"> -->
467 <!-- <item><ref id="getchar" name="getchar"> -->
468 <!-- <item><ref id="gets" name="gets"> -->
469 <!-- <item><ref id="printf" name="printf"> -->
470 <!-- <item><ref id="putc" name="putc"> -->
471 <!-- <item><ref id="putchar" name="putchar"> -->
472 <!-- <item><ref id="puts" name="puts"> -->
473 <item><ref id="rename" name="rename">
474 <item><ref id="remove" name="remove">
475 <!-- <item><ref id="rewind" name="rewind"> -->
476 <!-- <item><ref id="scanf" name="scanf"> -->
477 <!-- <item><ref id="snprintf" name="snprintf"> -->
478 <!-- <item><ref id="sprintf" name="sprintf"> -->
479 <!-- <item><ref id="sscanf" name="sscanf"> -->
480 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
481 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
482 <!-- <item><ref id="vprintf" name="vprintf"> -->
483 <!-- <item><ref id="vscanf" name="vscanf"> -->
484 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
485 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
486 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
487 </itemize>
488
489 (incomplete)
490
491
492 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
493
494 <itemize>
495 <item><ref id="_heapadd" name="_heapadd">
496 <item><ref id="_heapblocksize" name="_heapblocksize">
497 <item><ref id="_heapmaxavail" name="_heapmaxavail">
498 <item><ref id="_heapmemavail" name="_heapmemavail">
499 <item><ref id="_randomize" name="_randomize">
500 <item><ref id="_swap" name="_swap">
501 <item><ref id="abort" name="abort">
502 <item><ref id="abs" name="abs">
503 <item><ref id="atexit" name="atexit">
504 <item><ref id="atoi" name="atoi">
505 <item><ref id="atol" name="atol">
506 <item><ref id="bsearch" name="bsearch">
507 <item><ref id="calloc" name="calloc">
508 <item><ref id="div" name="div">
509 <item><ref id="exit" name="exit">
510 <item><ref id="free" name="free">
511 <item><ref id="getenv" name="getenv">
512 <item><ref id="itoa" name="itoa">
513 <item><ref id="labs" name="labs">
514 <item><ref id="ltoa" name="ltoa">
515 <item><ref id="malloc" name="malloc">
516 <item><ref id="perror" name="perror">
517 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
518 <!-- <item><ref id="putenv" name="putenv"> -->
519 <item><ref id="qsort" name="qsort">
520 <item><ref id="rand" name="rand">
521 <item><ref id="realloc" name="realloc">
522 <item><ref id="srand" name="srand">
523 <!-- <item><ref id="system" name="system"> -->
524 <item><ref id="ultoa" name="ultoa">
525 <item><ref id="utoa" name="utoa">
526 </itemize>
527
528 (incomplete)
529
530
531 <sect1><tt/string.h/<label id="string.h"><p>
532
533 <itemize>
534 <item><ref id="_stroserror" name="_stroserror">
535 <item><ref id="bzero" name="bzero">
536 <item><ref id="memchr" name="memchr">
537 <item><ref id="memcmp" name="memcmp">
538 <item><ref id="memcpy" name="memcpy">
539 <item><ref id="memmove" name="memmove">
540 <item><ref id="memset" name="memset">
541 <item><ref id="strcasecmp" name="strcasecmp">
542 <item><ref id="strcat" name="strcat">
543 <item><ref id="strchr" name="strchr">
544 <item><ref id="strcmp" name="strcmp">
545 <item><ref id="strcoll" name="strcoll">
546 <item><ref id="strcpy" name="strcpy">
547 <item><ref id="strcspn" name="strcspn">
548 <item><ref id="strdup" name="strdup">
549 <item><ref id="strerror" name="strerror">
550 <item><ref id="stricmp" name="stricmp">
551 <item><ref id="strlen" name="strlen">
552 <item><ref id="strlower" name="strlower">
553 <item><ref id="strlwr" name="strlwr">
554 <item><ref id="strncat" name="strncat">
555 <item><ref id="strncmp" name="strncmp">
556 <item><ref id="strncpy" name="strncpy">
557 <item><ref id="strrchr" name="strrchr">
558 <item><ref id="strspn" name="strspn">
559 <item><ref id="strstr" name="strstr">
560 <item><ref id="strtok" name="strtok">
561 <item><ref id="strxfrm" name="strxfrm">
562 <item><ref id="strupper" name="strupper">
563 <item><ref id="strupr" name="strupr">
564 </itemize>
565
566 (incomplete)
567
568
569 <sect1><tt/tgi.h/<label id="tgi.h"><p>
570
571 <itemize>
572 <item><ref id="tgi_arc" name="tgi_arc">
573 <item><ref id="tgi_bar" name="tgi_bar">
574 <item><ref id="tgi_circle" name="tgi_circle">
575 <item><ref id="tgi_clear" name="tgi_clear">
576 <item><ref id="tgi_done" name="tgi_done">
577 <item><ref id="tgi_ellipse" name="tgi_ellipse">
578 <item><ref id="tgi_getaspectratio" name="tgi_getaspectratio">
579 <item><ref id="tgi_getcolor" name="tgi_getcolor">
580 <item><ref id="tgi_getcolorcount" name="tgi_getcolorcount">
581 <item><ref id="tgi_getdefpalette" name="tgi_getdefpalette">
582 <item><ref id="tgi_geterror" name="tgi_geterror">
583 <item><ref id="tgi_geterrormsg" name="tgi_geterrormsg">
584 <item><ref id="tgi_getmaxcolor" name="tgi_getmaxcolor">
585 <item><ref id="tgi_getmaxx" name="tgi_getmaxx">
586 <item><ref id="tgi_getmaxy" name="tgi_getmaxy">
587 <item><ref id="tgi_getpagecount" name="tgi_getpagecount">
588 <item><ref id="tgi_getpalette" name="tgi_getpalette">
589 <item><ref id="tgi_getpixel" name="tgi_getpixel">
590 <item><ref id="tgi_getxres" name="tgi_getxres">
591 <item><ref id="tgi_getyres" name="tgi_getyres">
592 <item><ref id="tgi_gotoxy" name="tgi_gotoxy">
593 <item><ref id="tgi_init" name="tgi_init">
594 <item><ref id="tgi_install" name="tgi_install">
595 <item><ref id="tgi_ioctl" name="tgi_ioctl">
596 <item><ref id="tgi_line" name="tgi_line">
597 <item><ref id="tgi_lineto" name="tgi_lineto">
598 <item><ref id="tgi_load_driver" name="tgi_load_driver">
599 <item><ref id="tgi_outtext" name="tgi_outtext">
600 <item><ref id="tgi_outtextxy" name="tgi_outtextxy">
601 <item><ref id="tgi_setaspectratio" name="tgi_setaspectratio">
602 <item><ref id="tgi_setcolor" name="tgi_setcolor">
603 <item><ref id="tgi_setdrawpage" name="tgi_setdrawpage">
604 <item><ref id="tgi_setpalette" name="tgi_setpalette">
605 <item><ref id="tgi_setpixel" name="tgi_setpixel">
606 <item><ref id="tgi_setviewpage" name="tgi_setviewpage">
607 <item><ref id="tgi_gettextheight" name="tgi_gettextheight">
608 <item><ref id="tgi_settextstyle" name="tgi_settextstyle">
609 <item><ref id="tgi_gettextwidth" name="tgi_gettextwidth">
610 <item><ref id="tgi_uninstall" name="tgi_uninstall">
611 <item><ref id="tgi_unload" name="tgi_unload">
612 </itemize>
613
614 <sect1><tt/time.h/<label id="time.h"><p>
615
616 <itemize>
617 <!-- <item><ref id="_systime" name="_systime"> -->
618 <!-- <item><ref id="asctime" name="asctime"> -->
619 <item><ref id="clock" name="clock">
620 <!-- <item><ref id="ctime" name="ctime"> -->
621 <!-- <item><ref id="gmtime" name="gmtime"> -->
622 <!-- <item><ref id="localtime" name="localtime"> -->
623 <!-- <item><ref id="mktime" name="mktime"> -->
624 <!-- <item><ref id="strftime" name="strftime"> -->
625 <item><ref id="time" name="time">
626 </itemize>
627
628 (incomplete)
629
630
631 <sect1><tt/unistd.h/<label id="unistd.h"><p>
632
633 <itemize>
634 <!-- <item><ref id="chdir" name="chdir"> -->
635 <item><ref id="exec" name="exec">
636 <!-- <item><ref id="getcwd" name="getcwd"> -->
637 <item><ref id="getopt" name="getopt">
638 <!-- <item><ref id="lseek" name="lseek"> -->
639 <!-- <item><ref id="mkdir" name="mkdir"> -->
640 <!-- <item><ref id="read" name="read"> -->
641 <!-- <item><ref id="rmdir" name="rmdir"> -->
642 <item><ref id="sleep" name="sleep">
643 <item><ref id="unlink" name="unlink">
644 <!-- <item><ref id="write" name="write"> -->
645 </itemize>
646
647 (incomplete)
648
649
650 <sect1><tt/vic20.h/<label id="vic20.h"><p>
651
652 (incomplete)
653
654
655 <sect1><tt/zlib.h/<label id="zlib.h"><p>
656
657 <!-- <itemize> -->
658 <!-- <item><ref id="adler32" name="adler32"> -->
659 <!-- <item><ref id="crc32" name="crc32"> -->
660 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
661 <!-- <item><ref id="uncompress" name="uncompress"> -->
662 <!-- </itemize> -->
663
664 (incomplete)
665
666
667 <sect>Alphabetical function reference<p>
668
669 <sect1>_heapadd<label id="_heapadd"><p>
670
671 <quote>
672 <descrip>
673 <tag/Function/Add a block to the heap.
674 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
675 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
676 <tag/Description/The function adds a block of raw memory to the heap.
677 <tag/Limits/
678 <itemize>
679 <item>The minimum blocksize that can be added is 6 bytes; the function will
680 ignore smaller blocks.
681 </itemize>
682 <tag/Availability/cc65
683 <tag/See also/
684 <ref id="_heapblocksize" name="_heapblocksize">,
685 <ref id="_heapmaxavail" name="_heapmaxavail">,
686 <ref id="_heapmemavail" name="_heapmemavail">,
687 <ref id="calloc" name="calloc">,
688 <ref id="free" name="free">,
689 <ref id="malloc" name="malloc">,
690 <ref id="realloc" name="realloc">
691 <tag/Example/None.
692 </descrip>
693 </quote>
694
695
696 <sect1>_heapblocksize<label id="_heapblocksize"><p>
697
698 <quote>
699 <descrip>
700 <tag/Function/Return the size of an allocated block.
701 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
702 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
703 <tag/Description/The function returns the size of a block that must have
704 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
705 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
706 <tag/Limits/
707 <itemize>
708 <item>Passing a pointer to a block that was is not the result of one of the
709 allocation functions, or that has been free'd will give unpredicable results.
710 </itemize>
711 <tag/Availability/cc65
712 <tag/See also/
713 <ref id="_heapadd" name="_heapadd">,
714 <ref id="_heapmaxavail" name="_heapmaxavail">,
715 <ref id="_heapmemavail" name="_heapmemavail">,
716 <ref id="calloc" name="calloc">,
717 <ref id="free" name="free">,
718 <ref id="malloc" name="malloc">,
719 <ref id="realloc" name="realloc">
720 <tag/Example/None.
721 </descrip>
722 </quote>
723
724
725 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
726
727 <quote>
728 <descrip>
729 <tag/Function/Return the largest block that is available on the heap.
730 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
731 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
732 <tag/Description/The function returns the size of the largest block that may
733 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
734 <tag/Availability/cc65
735 <tag/See also/
736 <ref id="_heapadd" name="_heapadd">,
737 <ref id="_heapblocksize" name="_heapblocksize">,
738 <ref id="_heapmemavail" name="_heapmemavail">,
739 <ref id="calloc" name="calloc">,
740 <ref id="free" name="free">,
741 <ref id="malloc" name="malloc">,
742 <ref id="realloc" name="realloc">
743 <tag/Example/None.
744 </descrip>
745 </quote>
746
747
748 <sect1>_heapmemavail<label id="_heapmemavail"><p>
749
750 <quote>
751 <descrip>
752 <tag/Function/Return the total available space on the heap.
753 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
754 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
755 <tag/Description/The function returns the total number of bytes available on
756 the heap.
757 <tag/Limits/
758 <itemize>
759 <item>This function is of less use than usually assumed, since the returned
760 heap space may be available but not in one block. So even if this function
761 says that several times more heap space is available than needed, <ref
762 id="malloc" name="malloc"> may still return <tt/NULL/.
763 </itemize>
764 <tag/Availability/cc65
765 <tag/See also/
766 <ref id="_heapadd" name="_heapadd">,
767 <ref id="_heapblocksize" name="_heapblocksize">,
768 <ref id="_heapmaxavail" name="_heapmaxavail">,
769 <ref id="calloc" name="calloc">,
770 <ref id="free" name="free">,
771 <ref id="malloc" name="malloc">,
772 <ref id="realloc" name="realloc">
773 <tag/Example/None.
774 </descrip>
775 </quote>
776
777
778 <sect1>_poserror<label id="_poserror"><p>
779
780 <quote>
781 <descrip>
782 <tag/Function/Print an error message for the error in <tt/_oserror/.
783 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
784 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
785 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
786 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
787 a colon and a blank. Then the error message for the current contents of
788 <tt/_oserror/ are printed followed by a newline. The message output is the
789 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
790 argument of <tt/_oserror/.
791 <tag/Limits/
792 <itemize>
793 <item>Since operating system specific error code are - you guessed it -
794 operating system specific, the value in <tt/_oserror/ and the message that is
795 printed depends on the cc65 target.
796 <item>The function is only available as fastcall function, so it may only
797 be used in presence of a prototype.
798 </itemize>
799 <tag/Availability/cc65
800 <tag/See also/
801 <ref id="_stroserror" name="_stroserror">,
802 <ref id="perror" name="perror">
803 <tag/Example/None.
804 </descrip>
805 </quote>
806
807
808 <sect1>_randomize<label id="_randomize"><p>
809
810 <quote>
811 <descrip>
812 <tag/Function/Initialize the pseudo random number generator.
813 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
814 <tag/Declaration/<tt/void _randomize (void);/
815 <tag/Description/The function initializes the random number generator with
816 a seed derived from fast changing hardware events, so the seed itself can be
817 considered random to a certain degree.
818 <tag/Limits/<itemize>
819 <item>The randomness of the seed depends on the machine hardware.
820 </itemize>
821 <tag/Availability/cc65
822 <tag/See also/
823 <ref id="rand" name="rand">,
824 <ref id="srand" name="srand">
825 <tag/Example/None.
826 </descrip>
827 </quote>
828
829
830 <sect1>_stroserror<label id="_stroserror"><p>
831
832 <quote>
833 <descrip>
834 <tag/Function/Return a string describing an OS specific error code.
835 <tag/Header/<tt/<ref id="string.h" name="string.h">/
836 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
837 <tag/Description/<tt/_stroserror/ will return a string describing the given
838 operating system specific error code.
839 <tag/Limits/<itemize>
840 <item>Since operating system specific error code are - you guessed it -
841 operating system specific, the parameter and the string returned depend on the
842 cc65 target.
843 <item>The function is only available as fastcall function, so it may only be
844 used in presence of a prototype.
845 </itemize>
846 <tag/Availability/cc65
847 <tag/See also/
848 <ref id="strerror" name="strerror">
849 <tag/Example/None.
850 </descrip>
851 </quote>
852
853
854 <sect1>_swap<label id="_swap"><p>
855
856 <quote>
857 <descrip>
858 <tag/Function/Swap the contents of memory areas.
859 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
860 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
861 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
862 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
863 <tt/size/ bytes in size.
864 <tag/Limits/<itemize>
865 <item>The memory areas may not overlap, otherwise the results are undefined.
866 <item>The function is only available as fastcall function, so it may only be
867 used in presence of a prototype.
868 </itemize>
869 <tag/Availability/cc65
870 <tag/See also/
871 <ref id="memcpy" name="memcpy">,
872 <ref id="memmove" name="memmove">
873 <tag/Example/None.
874 </descrip>
875 </quote>
876
877
878 <sect1>_sys<label id="_sys"><p>
879
880 <quote>
881 <descrip>
882 <tag/Function/Call a subroutine passing register values.
883 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
884 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
885 <tag/Description/The function will call the subroutine at the address
886 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
887 registers and the CPU flags are set to the values given in the <tt/regs/
888 structure. On return from the subroutine, the new values of the registers and
889 flags are stored back overwriting the old values.
890 <tag/Limits/<itemize>
891 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
892 when calling the subroutine (they are unchanged from their current values).
893 <item>The function is only available as fastcall function, so it may only be
894 used in presence of a prototype.
895 </itemize>
896 <tag/Availability/cc65
897 <tag/Example/None.
898 </descrip>
899 </quote>
900
901
902 <sect1>BRK<label id="BRK"><p>
903
904 <quote>
905 <descrip>
906 <tag/Function/Insert a 6502 BRK instrunction into the code.
907 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
908 <tag/Declaration/<tt/void BRK (void);/
909 <tag/Description/The function will insert a 6502 BRK instruction into the code
910 which may be used to trigger a debugger.
911 <tag/Limits/<itemize>
912 <item>The function is actually a macro.
913 <item>The inserted instruction may lead to unexpected results if no debugger
914 is present.
915 </itemize>
916 <tag/Availability/cc65
917 <tag/See also/
918 <ref id="CLI" name="CLI">,
919 <ref id="SEI" name="SEI">
920 <tag/Example/None.
921 </descrip>
922 </quote>
923
924
925 <sect1>CLI<label id="CLI"><p>
926
927 <quote>
928 <descrip>
929 <tag/Function/Insert a 6502 CLI instrunction into the code.
930 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
931 <tag/Declaration/<tt/void CLI (void);/
932 <tag/Description/The function will insert a 6502 CLI instruction into the code,
933 so interrupts are enabled. Enabling interrupts has no effects if they are
934 already enabled (the default).
935 <tag/Limits/<itemize>
936 <item>The function is actually a macro.
937 <item>Disabling interrupts may lead to unexpected results.
938 </itemize>
939 <tag/Availability/cc65
940 <tag/See also/
941 <ref id="BRK" name="BRK">,
942 <ref id="SEI" name="SEI">
943 <tag/Example/None.
944 </descrip>
945 </quote>
946
947
948 <sect1>PEEK<label id="PEEK"><p>
949
950 <quote>
951 <descrip>
952 <tag/Function/Read a byte from memory.
953 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
954 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
955 <tag/Description/The function will read the absolute memory given by <tt/addr/
956 and return the value read.
957 <tag/Limits/<itemize>
958 <item>The function is actually a macro.
959 <item>This function depends highly on the platform and environment.
960 </itemize>
961 <tag/Availability/cc65
962 <tag/See also/
963 <ref id="PEEKW" name="PEEKW">,
964 <ref id="POKE" name="POKE">
965 <tag/Example/None.
966 </descrip>
967 </quote>
968
969
970 <sect1>PEEKW<label id="PEEKW"><p>
971
972 <quote>
973 <descrip>
974 <tag/Function/Read a word (two bytes) from memory.
975 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
976 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
977 <tag/Description/The function will read the absolute memory given by <tt/addr/
978 and return the value read. The byte read from the higher address is the high
979 byte of the return value.
980 <tag/Limits/<itemize>
981 <item>The function is actually a macro.
982 <item>This function depends highly on the platform and environment.
983 <item>The order in which the two bytes are read is unspecified and may
984 depend of the address expression used.
985 </itemize>
986 <tag/Availability/cc65
987 <tag/See also/
988 <ref id="PEEK" name="PEEK">,
989 <ref id="POKE" name="POKE">
990 <tag/Example/None.
991 </descrip>
992 </quote>
993
994
995 <sect1>POKE<label id="POKE"><p>
996
997 <quote>
998 <descrip>
999 <tag/Function/Write a byte to memory.
1000 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1001 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1002 <tag/Description/The function writes the value <tt/val/ to the absolute
1003 memory address given by <tt/addr/.
1004 <tag/Limits/<itemize>
1005 <item>The function is actually a macro.
1006 <item>This function depends highly on the platform and environment.
1007 <item>Careless use will cause the program to act strange or may crash the
1008 machine.
1009 </itemize>
1010 <tag/Availability/cc65
1011 <tag/See also/
1012 <ref id="PEEK" name="PEEK">,
1013 <ref id="POKEW" name="POKEW">
1014 <tag/Example/None.
1015 </descrip>
1016 </quote>
1017
1018
1019 <sect1>POKEW<label id="POKEW"><p>
1020
1021 <quote>
1022 <descrip>
1023 <tag/Function/Write a word (two bytes) to memory.
1024 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1025 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1026 <tag/Description/The function writes the value <tt/val/ to the absolute
1027 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1028 the <tt/addr/, the high byte is written to <tt/addr+1/.
1029 <tag/Limits/<itemize>
1030 <item>The function is actually a macro.
1031 <item>This function depends highly on the platform and environment.
1032 <item>Careless use will cause the program to act strange or may crash the
1033 machine.
1034 <item>The order in which the two bytes are written is unspecified and may
1035 depend of the address expression used.
1036 </itemize>
1037 <tag/Availability/cc65
1038 <tag/See also/
1039 <ref id="PEEK" name="PEEK">,
1040 <ref id="POKE" name="POKE">
1041 <tag/Example/None.
1042 </descrip>
1043 </quote>
1044
1045
1046 <sect1>SEI<label id="SEI"><p>
1047
1048 <quote>
1049 <descrip>
1050 <tag/Function/Insert a 6502 SEI instrunction into the code.
1051 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1052 <tag/Declaration/<tt/void SEI (void);/
1053 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1054 so interrupts are disabled. Note that non maskable interrupts cannot be
1055 disabled.
1056 <tag/Limits/<itemize>
1057 <item>The function is actually a macro.
1058 <item>Disabling interrupts may lead to unexpected results.
1059 </itemize>
1060 <tag/Availability/cc65
1061 <tag/See also/
1062 <ref id="BRK" name="BRK">,
1063 <ref id="CLI" name="CLI">
1064 <tag/Example/None.
1065 </descrip>
1066 </quote>
1067
1068
1069 <sect1>abort<label id="abort"><p>
1070
1071 <quote>
1072 <descrip>
1073 <tag/Function/Terminates a program abnormally.
1074 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1075 <tag/Declaration/<tt/void abort (void);/
1076 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1077 on stderr, then terminates the program with an exit code of 3.
1078 <tag/Availability/ISO 9899
1079 <tag/See also/
1080 <ref id="assert" name="assert">,
1081 <ref id="exit" name="exit">,
1082 <ref id="raise" name="raise">
1083 <tag/Example/None.
1084 </descrip>
1085 </quote>
1086
1087
1088 <sect1>abs<label id="abs"><p>
1089
1090 <quote>
1091 <descrip>
1092 <tag/Function/Returns the absolute value of an integer.
1093 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1094 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1095 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1096 the function.
1097 <tag/Limits/<itemize>
1098 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1099 <item>The function is only available as fastcall function, so it may only be
1100 used in presence of a prototype.
1101 </itemize>
1102 <tag/Availability/ISO 9899
1103 <tag/See also/
1104 <ref id="labs" name="labs">
1105 <tag/Example/None.
1106 </descrip>
1107 </quote>
1108
1109
1110 <sect1>assert<label id="assert"><p>
1111
1112 <quote>
1113 <descrip>
1114 <tag/Function/Test a condition and possibly abort.
1115 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1116 <tag/Declaration/<tt/void assert (int cond);/
1117 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1118 statement. If the condition evaluates t zero (false), assert prints a message
1119 on stderr and aborts the program.
1120 <tag/Limits/<itemize>
1121 <item>The function is actually a macro.
1122 </itemize>
1123 <tag/Availability/ISO 9899
1124 <tag/See also/
1125 <ref id="abort" name="abort">,
1126 <ref id="exit" name="exit">
1127 <tag/Example/None.
1128 </descrip>
1129 </quote>
1130
1131
1132 <sect1>atexit<label id="atexit"><p>
1133
1134 <quote>
1135 <descrip>
1136 <tag/Function/Register an exit function.
1137 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1138 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1139 <tag/Description/<tt/atexit/ registers the function pointed to by
1140 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1141 terminates, they are called in LIFO order (the last function registered is
1142 called first). <tt/atexit/ returns zero on success and a nonzero value on
1143 failure.
1144 <tag/Limits/<itemize>
1145 <item>A maximum of 5 exit functions can be registered.
1146 <item>There is no way to unregister an exit function.
1147 <item>The function is only available as fastcall function, so it may only be
1148 used in presence of a prototype.
1149 </itemize>
1150 <tag/Availability/ISO 9899
1151 <tag/See also/
1152 <ref id="abort" name="abort">,
1153 <ref id="exit" name="exit">
1154 <tag/Example/None.
1155 </descrip>
1156 </quote>
1157
1158
1159 <sect1>atoi<label id="atoi"><p>
1160
1161 <quote>
1162 <descrip>
1163 <tag/Function/Convert a string to an integer.
1164 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1165 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1166 <tag/Description/<tt/atoi/ converts the given string into an integer.
1167 Conversion stops as soon as any invalid character is encountered.
1168 <tag/Limits/<itemize>
1169 <item>There is no way to detect any conversion errors.
1170 <item>The function does not check for an numerical overflow when converting.
1171 <item>The function is only available as fastcall function, so it may only be
1172 used in presence of a prototype.
1173 </itemize>
1174 <tag/Availability/ISO 9899
1175 <tag/See also/
1176 <ref id="atol" name="atol">,
1177 <ref id="itoa" name="itoa">,
1178 <ref id="ltoa" name="ltoa">,
1179 <ref id="ultoa" name="ultoa">,
1180 <ref id="utoa" name="utoa">
1181 <tag/Example/None.
1182 </descrip>
1183 </quote>
1184
1185
1186 <sect1>atol<label id="atol"><p>
1187
1188 <quote>
1189 <descrip>
1190 <tag/Function/Convert a string to a long integer.
1191 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1192 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1193 <tag/Description/<tt/atol/ converts the given string into a long integer.
1194 Conversion stops as soon as any invalid character is encountered.
1195 <tag/Limits/<itemize>
1196 <item>There is no way to detect any conversion errors.
1197 <item>The function does not check for an numerical overflow when converting.
1198 <item>The function is only available as fastcall function, so it may only be
1199 used in presence of a prototype.
1200 </itemize>
1201 <tag/Availability/ISO 9899
1202 <tag/See also/
1203 <ref id="atoi" name="atoi">,
1204 <ref id="itoa" name="itoa">,
1205 <ref id="ltoa" name="ltoa">,
1206 <ref id="ultoa" name="ultoa">,
1207 <ref id="utoa" name="utoa">
1208 <tag/Example/None.
1209 </descrip>
1210 </quote>
1211
1212
1213 <sect1>bgcolor<label id="bgcolor"><p>
1214
1215 <quote>
1216 <descrip>
1217 <tag/Function/Set the background text color.
1218 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1219 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1220 <tag/Description/The function will set a new background color and return the
1221 old (current) one. The background color is valid for the whole text output
1222 area of the screen, not just for new text.
1223 <tag/Limits/<itemize>
1224 <item>Background colors are system dependent. The function may have no effect
1225 on systems where the background color cannot be changed.
1226 <item>The function is only available as fastcall function, so it may only be
1227 used in presence of a prototype.
1228 </itemize>
1229 <tag/Availability/cc65
1230 <tag/See also/
1231 <ref id="bordercolor" name="bordercolor">,
1232 <ref id="textcolor" name="textcolor">
1233 <tag/Example/None.
1234 </descrip>
1235 </quote>
1236
1237
1238 <sect1>bordercolor<label id="bordercolor"><p>
1239
1240 <quote>
1241 <descrip>
1242 <tag/Function/Set the border (frame) color.
1243 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1244 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1245 <tag/Description/The function will set a new border color. It returns the old
1246 (current) border color.
1247 <tag/Limits/<itemize>
1248 <item>Border colors are system dependent. The function may have no effect
1249 on systems where the border color cannot be changed.
1250 <item>The function is only available as fastcall function, so it may only
1251 be used in presence of a prototype.
1252 </itemize>
1253 <tag/Availability/cc65
1254 <tag/See also/
1255 <ref id="bgcolor" name="bgcolor">,
1256 <ref id="textcolor" name="textcolor">
1257 <tag/Example/None.
1258 </descrip>
1259 </quote>
1260
1261
1262 <sect1>bsearch<label id="bsearch"><p>
1263
1264 <quote>
1265 <descrip>
1266 <tag/Function/Do a binary search in a sorted array.
1267 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1268 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1269 const void* base, size_t n, size_t size,
1270 int (*cmp) (const void*, const void*));/
1271 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1272 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1273 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1274 the function used to compare the members against the key. The function returns
1275 a pointer to the member found, or <tt/NULL/ if there was no match.
1276 <tag/Limits/
1277 <itemize>
1278 <item>The contents of the array must be sorted in ascending order according to
1279 the compare function given.
1280 <item>If there are multiple members that match the key, the function will
1281 return one of the members.
1282 <item>The function is only available as fastcall function, so it may only
1283 be used in presence of a prototype.
1284 </itemize>
1285 <tag/Availability/ISO 9899
1286 <tag/See also/
1287 <ref id="qsort" name="qsort">
1288 <tag/Example/None.
1289 </descrip>
1290 </quote>
1291
1292
1293 <sect1>bzero<label id="bzero"><p>
1294
1295 <quote>
1296 <descrip>
1297 <tag/Function/Fill a memory area with zeroes.
1298 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1299 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1300 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1301 zero.
1302 <tag/Limits/
1303 <itemize>
1304 <item>The function is non standard and therefore only available in non ANSI
1305 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1306 <item>The function is only available as fastcall function, so it may only
1307 be used in presence of a prototype.
1308 </itemize>
1309 <tag/Availability/cc65
1310 <tag/See also/
1311 <ref id="_swap" name="_swap">,
1312 <ref id="memcpy" name="memcpy">,
1313 <ref id="memmove" name="memmove">,
1314 <ref id="memset" name="memset">,
1315 <tag/Example/None.
1316 </descrip>
1317 </quote>
1318
1319
1320 <sect1>c64mode<label id="c64mode"><p>
1321
1322 <quote>
1323 <descrip>
1324 <tag/Function/Switch the C128 into C64 compatible mode.
1325 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1326 <tag/Declaration/<tt/void c64mode (void);/
1327 <tag/Description/The function will cause the machine to reboot into C64 mode.
1328 <tag/Limits/<itemize>
1329 <item>The function is specific to the C128.
1330 <item>The function will not return to the caller.
1331 </itemize>
1332 <tag/Availability/C128
1333 <tag/Example/None.
1334 </descrip>
1335 </quote>
1336
1337
1338 <sect1>calloc<label id="calloc"><p>
1339
1340 <quote>
1341 <descrip>
1342 <tag/Function/Allocate and clear memory.
1343 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1344 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1345 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1346 of size <tt/size/, clears the whole block with binary zeroes and returns a
1347 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1348 <tt/NULL/.
1349 <tag/Limits/
1350 <itemize>
1351 <item>Clearing the memory may not have the expected effect on all platforms:
1352 pointers in the block may not be <tt/NULL/ and floating point variables may
1353 not be zero (0.0). In other words: The "clearing" effect of this function
1354 should be used with care for portable programs.
1355 <item>The function is only available as fastcall function, so it may only
1356 be used in presence of a prototype.
1357 </itemize>
1358 <tag/Availability/ISO 9899
1359 <tag/See also/
1360 <ref id="_heapadd" name="_heapadd">,
1361 <ref id="_heapblocksize" name="_heapblocksize">,
1362 <ref id="_heapmaxavail" name="_heapmaxavail">,
1363 <ref id="_heapmemavail" name="_heapmemavail">,
1364 <ref id="free" name="free">,
1365 <ref id="malloc" name="malloc">,
1366 <ref id="realloc" name="realloc">
1367 <tag/Example/None.
1368 </descrip>
1369 </quote>
1370
1371
1372 <sect1>cclear<label id="cclear"><p>
1373
1374 <quote>
1375 <descrip>
1376 <tag/Function/Clear part of a line (write a given number of spaces).
1377 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1378 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
1379 <tag/Description/The function clears part of a line by writing <tt/length/
1380 spaces in the current text color.
1381 <tag/Limits/<itemize>
1382 <item>The function is only available as fastcall function, so it may
1383 only be used in presence of a prototype.
1384 </itemize>
1385 <tag/Availability/cc65
1386 <tag/See also/
1387 <ref id="cclearxy" name="cclearxy">,
1388 <ref id="clrscr" name="clrscr">
1389 <tag/Example/None.
1390 </descrip>
1391 </quote>
1392
1393
1394 <sect1>cclearxy<label id="cclearxy"><p>
1395
1396 <quote>
1397 <descrip>
1398 <tag/Function/Clear part of a line (write a given number of spaces) starting
1399 at a specific screen position.
1400 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1401 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
1402 <tag/Description/The function moves the cursor to a specific position, and
1403 will then clear part of the line by writing <tt/length/ spaces in the current
1404 text color.
1405 <tag/Limits/<itemize>
1406 <item>The function is only available as fastcall function, so it may
1407 only be used in presence of a prototype.
1408 </itemize>
1409 <tag/Availability/cc65
1410 <tag/See also/
1411 <ref id="cclear" name="cclear">,
1412 <ref id="clrscr" name="clrscr">
1413 <tag/Example/None.
1414 </descrip>
1415 </quote>
1416
1417
1418 <sect1>cgetc<label id="cgetc"><p>
1419
1420 <quote>
1421 <descrip>
1422 <tag/Function/Read a character from the keyboard.
1423 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1424 <tag/Declaration/<tt/char cgetc (void);/
1425 <tag/Description/The function reads a character from the keyboard. If there is
1426 no character available, <tt/cgetc/ waits until the user presses a key. If the
1427 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1428 displayed while waiting.
1429 <tag/Limits/<itemize>
1430 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1431 from this buffer and wait only if the buffer is empty.
1432 </itemize>
1433 <tag/Availability/cc65
1434 <tag/See also/
1435 <ref id="cursor" name="cursor">,
1436 <ref id="kbhit" name="kbhit">
1437 <tag/Example/None.
1438 </descrip>
1439 </quote>
1440
1441
1442 <sect1>chline<label id="chline"><p>
1443
1444 <quote>
1445 <descrip>
1446 <tag/Function/Output a horizontal line in text mode.
1447 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1448 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1449 <tag/Description/The function outputs a horizontal line with the given length
1450 starting at the current cursor position.
1451 <tag/Limits/<itemize>
1452 <item>The character used to draw the horizontal line is system dependent.
1453 If available, a line drawing character is used. Drawing a line that is partially
1454 off screen leads to undefined behaviour.
1455 <item>The function is only available as fastcall function, so it may only be
1456 used in presence of a prototype.
1457 </itemize>
1458 <tag/Availability/cc65
1459 <tag/See also/
1460 <ref id="chlinexy" name="chlinexy">,
1461 <ref id="cvline" name="cvline">,
1462 <ref id="cvlinexy" name="cvlinexy">
1463 <tag/Example/None.
1464 </descrip>
1465 </quote>
1466
1467
1468 <sect1>chlinexy<label id="chlinexy"><p>
1469
1470 <quote>
1471 <descrip>
1472 <tag/Function/Output a horizontal line at a given position in text mode.
1473 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1474 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1475 <tag/Description/The function outputs a horizontal line with the given length
1476 starting at a given position.
1477 <tag/Limits/<itemize>
1478 <item>The character used to draw the horizontal line is system dependent.
1479 If available, a line drawing character is used. Drawing a line that is partially
1480 off screen leads to undefined behaviour.
1481 <item>The function is only available as fastcall function, so it may only be
1482 used in presence of a prototype.
1483 </itemize>
1484 <tag/Availability/cc65
1485 <tag/See also/
1486 <ref id="chline" name="chline">,
1487 <ref id="cvline" name="cvline">,
1488 <ref id="cvlinexy" name="cvlinexy">
1489 <tag/Example/None.
1490 </descrip>
1491 </quote>
1492
1493
1494 <sect1>clearerr<label id="clearerr"><p>
1495
1496 <quote>
1497 <descrip>
1498 <tag/Function/Clear error and end-of-file status of a stream.
1499 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1500 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
1501 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
1502 indicators for the stream <tt/f/.
1503 <tag/Limits/<itemize>
1504 <item>The function is only available as fastcall function, so it may only be
1505 used in presence of a prototype.
1506 </itemize>
1507 <tag/Availability/ISO 9899
1508 <tag/See also/
1509 <ref id="feof" name="feof">,
1510 <ref id="ferror" name="ferror">
1511 <tag/Example/None.
1512 </descrip>
1513 </quote>
1514
1515
1516 <sect1>clock<label id="clock"><p>
1517
1518 <quote>
1519 <descrip>
1520 <tag/Function/Determine the processor time used.
1521 <tag/Header/<tt/<ref id="time.h" name="time.h">/
1522 <tag/Declaration/<tt/clock_t clock (void);/
1523 <tag/Description/The <tt/clock/ function returns an approximaton of processor
1524 time used by the program. The time is returned in implementation defined
1525 units. It can be converted to seconds by dividing by the value of the macro
1526 <tt/CLOCKS_PER_SEC/.
1527 <tag/Limits/<itemize>
1528 <item>Since the machines, cc65 generated programs run on, cannot run multiple
1529 processes, the function will actually return the time since some
1530 implementation defined point in the past.
1531 </itemize>
1532 <tag/Availability/ISO 9899
1533 <tag/See also/
1534 <ref id="time" name="time">
1535 <tag/Example/None.
1536 </descrip>
1537 </quote>
1538
1539
1540 <sect1>clrscr<label id="clrscr"><p>
1541
1542 <quote>
1543 <descrip>
1544 <tag/Function/Clear the text screen.
1545 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1546 <tag/Declaration/<tt/void clrscr (void);/
1547 <tag/Description/The function clears the text screen and moves the cursor to
1548 the upper left corner.
1549 <tag/Availability/cc65
1550 <tag/See also/
1551 <ref id="cclear" name="cclear">,
1552 <ref id="cclearxy" name="cclearxy">
1553 <tag/Example/None.
1554 </descrip>
1555 </quote>
1556
1557
1558 <sect1>close<label id="close"><p>
1559
1560 <quote>
1561 <descrip>
1562 <tag/Function/Close a file descriptor.
1563 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1564 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1565 <tag/Description/The function closes the given file descriptor. It returns zero
1566 on success and -1 on error. If an error occurs, the cause can be determined by
1567 reading the <tt/errno/ variable.
1568 <tag/Limits/<itemize>
1569 <item>The function is only available as fastcall function, so it may only
1570 be used in presence of a prototype.
1571 </itemize>
1572 <tag/Availability/POSIX 1003.1
1573 <tag/See also/
1574 <ref id="creat" name="creat">,
1575 <ref id="open" name="open">
1576 <tag/Example/None.
1577 </descrip>
1578 </quote>
1579
1580
1581 <sect1>creat<label id="creat"><p>
1582
1583 <quote>
1584 <descrip>
1585 <tag/Function/Create a file.
1586 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1587 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1588 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1589 associated with it. On error, -1 is returned and an error code is stored in
1590 <tt/errno/.
1591 <tag/Limits/<itemize>
1592 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1593 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1594 <item>The function is only available as fastcall function, so it may only
1595 be used in presence of a prototype.
1596 </itemize>
1597 <tag/Availability/POSIX 1003.1
1598 <tag/See also/
1599 <ref id="close" name="close">,
1600 <ref id="open" name="open">
1601 <tag/Example/None.
1602 </descrip>
1603 </quote>
1604
1605
1606 <sect1>cprintf<label id="cprintf"><p>
1607
1608 <quote>
1609 <descrip>
1610 <tag/Function/Formatted output to the console.
1611 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1612 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
1613 <tag/Description/The arguments are converted to text where necessary and
1614 formatted according to the format string given. The resulting string is output
1615 to the console. <tt/cprintf/ supports the same format specifiers as
1616 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
1617 <tag/Limits/<itemize>
1618 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
1619 between <tt/\r/ and <tt/\n/.
1620 </itemize>
1621 <tag/Availability/cc65
1622 <tag/See also/
1623 <ref id="cputc" name="cputc">,
1624 <ref id="cputcxy" name="cputcxy">,
1625 <ref id="cputs" name="cputs">,
1626 <ref id="cputsxy" name="cputsxy">,
1627 <ref id="vcprintf" name="vcprintf">
1628 <tag/Example/None.
1629 </descrip>
1630 </quote>
1631
1632
1633 <sect1>cputc<label id="cputc"><p>
1634
1635 <quote>
1636 <descrip>
1637 <tag/Function/Output a character directly to the console.
1638 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1639 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
1640 <tag/Description/Output one character to the console at the current cursor
1641 position.
1642 <tag/Limits/<itemize>
1643 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
1644 between <tt/\r/ and <tt/\n/.
1645 <item>The function is only available as fastcall function, so it may only
1646 be used in presence of a prototype.
1647 </itemize>
1648 <tag/Availability/cc65
1649 <tag/See also/
1650 <ref id="cprintf" name="cprintf">,
1651 <ref id="cputcxy" name="cputcxy">,
1652 <ref id="cputs" name="cputs">,
1653 <ref id="cputsxy" name="cputsxy">,
1654 <ref id="vcprintf" name="vcprintf">
1655 <tag/Example/None.
1656 </descrip>
1657 </quote>
1658
1659
1660 <sect1>cputcxy<label id="cputcxy"><p>
1661
1662 <quote>
1663 <descrip>
1664 <tag/Function/Output a character at a specific screen position.
1665 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1666 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
1667 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
1668 the screen and outputs one character.
1669 <tag/Limits/<itemize>
1670 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
1671 between <tt/\r/ and <tt/\n/.
1672 <item>The function is only available as fastcall function, so it may only
1673 be used in presence of a prototype.
1674 </itemize>
1675 <tag/Availability/cc65
1676 <tag/See also/
1677 <ref id="cprintf" name="cprintf">,
1678 <ref id="cputc" name="cputc">,
1679 <ref id="cputs" name="cputs">,
1680 <ref id="cputsxy" name="cputsxy">,
1681 <ref id="vcprintf" name="vcprintf">
1682 <tag/Example/None.
1683 </descrip>
1684 </quote>
1685
1686
1687 <sect1>cputs<label id="cputs"><p>
1688
1689 <quote>
1690 <descrip>
1691 <tag/Function/Output a string directly to the console.
1692 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1693 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
1694 <tag/Description/The function outputs the given string on the console at the
1695 current cursor position.
1696 <tag/Limits/<itemize>
1697 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
1698 between <tt/\r/ and <tt/\n/.
1699 <item>The function is only available as fastcall function, so it may only
1700 be used in presence of a prototype.
1701 </itemize>
1702 <tag/Availability/cc65
1703 <tag/See also/
1704 <ref id="cprintf" name="cprintf">,
1705 <ref id="cputc" name="cputc">,
1706 <ref id="cputcxy" name="cputcxy">,
1707 <ref id="cputsxy" name="cputsxy">,
1708 <ref id="vcprintf" name="vcprintf">
1709 <tag/Example/None.
1710 </descrip>
1711 </quote>
1712
1713
1714 <sect1>cputsxy<label id="cputsxy"><p>
1715
1716 <quote>
1717 <descrip>
1718 <tag/Function/Output a string to the console at a given position.
1719 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1720 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
1721 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
1722 and outputs the string <tt/s/.
1723 <tag/Limits/<itemize>
1724 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
1725 between <tt/\r/ and <tt/\n/.
1726 <item>The function is only available as fastcall function, so it may only
1727 be used in presence of a prototype.
1728 </itemize>
1729 <tag/Availability/cc65
1730 <tag/See also/
1731 <ref id="cprintf" name="cprintf">,
1732 <ref id="cputc" name="cputc">,
1733 <ref id="cputcxy" name="cputcxy">,
1734 <ref id="cputs" name="cputs">,
1735 <ref id="vcprintf" name="vcprintf">
1736 <tag/Example/None.
1737 </descrip>
1738 </quote>
1739
1740
1741 <sect1>cursor<label id="cursor"><p>
1742
1743 <quote>
1744 <descrip>
1745 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1746 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1747 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1748 <tag/Description/If the argument to the function is non zero, a blinking cursor
1749 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1750 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1751 <tag/Limits/<itemize>
1752 <item>The function is only available as fastcall function, so it may only
1753 be used in presence of a prototype.
1754 </itemize>
1755 <tag/Availability/cc65
1756 <tag/See also/
1757 <ref id="cgetc" name="cgetc">,
1758 <ref id="kbhit" name="kbhit">
1759 <tag/Example/None.
1760 </descrip>
1761 </quote>
1762
1763
1764 <sect1>cvline<label id="cvline"><p>
1765
1766 <quote>
1767 <descrip>
1768 <tag/Function/Output a vertical line in text mode.
1769 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1770 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1771 <tag/Description/The function outputs a vertical line with the given length
1772 starting at the current cursor position.
1773 <tag/Limits/<itemize>
1774 <item>The character used to draw the vertical line is system dependent.
1775 If available, a line drawing character is used. Drawing a line that is partially
1776 off screen leads to undefined behaviour.
1777 <item>The function is only available as fastcall function, so it may only be
1778 used in presence of a prototype.
1779 </itemize>
1780 <tag/Availability/cc65
1781 <tag/See also/
1782 <ref id="chline" name="chline">,
1783 <ref id="chlinexy" name="chlinexy">,
1784 <ref id="cvlinexy" name="cvlinexy">
1785 <tag/Example/None.
1786 </descrip>
1787 </quote>
1788
1789
1790 <sect1>cvlinexy<label id="cvlinexy"><p>
1791
1792 <quote>
1793 <descrip>
1794 <tag/Function/Output a vertical line at a given position in text mode.
1795 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1796 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1797 <tag/Description/The function outputs a vertical line with the given length
1798 starting at a given position.
1799 <tag/Limits/<itemize>
1800 <item>The character used to draw the vertical line is system dependent.
1801 If available, a line drawing character is used. Drawing a line that is partially
1802 off screen leads to undefined behaviour.
1803 <item>The function is only available as fastcall function, so it may only be
1804 used in presence of a prototype.
1805 </itemize>
1806 <tag/Availability/cc65
1807 <tag/See also/
1808 <ref id="chline" name="chline">,
1809 <ref id="chlinexy" name="chlinexy">,
1810 <ref id="cvline" name="cvline">
1811 <tag/Example/None.
1812 </descrip>
1813 </quote>
1814
1815
1816 <sect1>div<label id="div"><p>
1817
1818 <quote>
1819 <descrip>
1820 <tag/Function/Divide two ints and return quotient and remainder.
1821 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1822 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1823 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1824 quotient and remainder in a <tt/div_t/ structure.
1825 <tag/Limits/
1826 <itemize>
1827 <item>The function is only available as fastcall function, so it may only
1828 be used in presence of a prototype.
1829 </itemize>
1830 <tag/Availability/ISO 9899
1831 <tag/See also/
1832 ldiv
1833 <tag/Example/None.
1834 </descrip>
1835 </quote>
1836
1837
1838 <sect1>em_commit<label id="em_commit"><p>
1839
1840 <quote>
1841 <descrip>
1842 <tag/Function/Commit changes into extended memory.
1843 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1844 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1845 <tag/Description/Commit changes in the memory window to extended storage. If
1846 the contents of the memory window have been changed, these changes may be lost
1847 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1848 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1849 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1850 <tag/Limits/<itemize>
1851 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1852 memory window are discarded, it does just mean that the drivers is allowed
1853 to discard it.
1854 <item>The function is only available as fastcall function, so it may only be
1855 used in presence of a prototype.
1856 <item>The function produces undefined results if no extended memory driver is
1857 loaded.
1858 </itemize>
1859 <tag/Availability/cc65
1860 <tag/See also/
1861 <ref id="em_load_driver" name="em_load_driver">,
1862 <ref id="em_map" name="em_map">,
1863 <ref id="em_use" name="em_use">
1864 <tag/Example/None.
1865 </descrip>
1866 </quote>
1867
1868
1869 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1870
1871 <quote>
1872 <descrip>
1873 <tag/Function/Copy from extended into normal memory.
1874 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1875 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1876 <tag/Description/Copy data from extended memory into linear memory. Source and
1877 target addresses as well as the number of bytes to transfer are specified in
1878 the <tt/em_copy/ structure that is passed as a parameter.
1879 <tag/Limits/<itemize>
1880 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1881 made any changes to the data in the window, call <tt/<ref id="em_commit"
1882 name="em_commit">/ first, or the changes are lost.
1883 <item>The function is only available as fastcall function, so it may only be
1884 used in presence of a prototype.
1885 <item>The function produces undefined results if no extended memory driver is
1886 loaded.
1887 </itemize>
1888 <tag/Availability/cc65
1889 <tag/See also/
1890 <ref id="em_commit" name="em_commit">,
1891 <ref id="em_copyto" name="em_copyto">,
1892 <ref id="em_load_driver" name="em_load_driver">
1893 <tag/Example/None.
1894 </descrip>
1895 </quote>
1896
1897
1898 <sect1>em_copyto<label id="em_copyto"><p>
1899
1900 <quote>
1901 <descrip>
1902 <tag/Function/Copy from normal into extended memory.
1903 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1904 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1905 <tag/Description/Copy data from linear into extended memory. Source and
1906 target addresses as well as the number of bytes to transfer are specified in
1907 the <tt/em_copy/ structure that is passed as a parameter.
1908 <tag/Limits/<itemize>
1909 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1910 made any changes to the data in the window, call <tt/<ref id="em_commit"
1911 name="em_commit">/ first, or the changes are lost.
1912 <item>The function is only available as fastcall function, so it may only be
1913 used in presence of a prototype.
1914 <item>The function produces undefined results if no extended memory driver is
1915 loaded.
1916 </itemize>
1917 <tag/Availability/cc65
1918 <tag/See also/
1919 <ref id="em_commit" name="em_commit">,
1920 <ref id="em_copyfrom" name="em_copyfrom">,
1921 <ref id="em_load_driver" name="em_load_driver">
1922 <tag/Example/None.
1923 </descrip>
1924 </quote>
1925
1926
1927 <sect1>em_install<label id="em_install"><p>
1928
1929 <quote>
1930 <descrip>
1931 <tag/Function/Install an already loaded extended memory driver.
1932 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1933 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
1934 <tag/Description/The function installs an already loaded extended memory driver
1935 and returns an error code. The function may be used to install a driver linked
1936 statically to the program.
1937 <tag/Limits/<itemize>
1938 <item>Not all drivers are able to detect if the supported hardware is really
1939 present.
1940 <item>The function is only available as fastcall function, so it may only be
1941 used in presence of a prototype.
1942 </itemize>
1943 <tag/Availability/cc65
1944 <tag/See also/
1945 <ref id="em_load_driver" name="em_load_driver">,
1946 <ref id="em_uninstall" name="em_uninstall">,
1947 <ref id="em_unload" name="em_unload">
1948 <tag/Example/None.
1949 </descrip>
1950 </quote>
1951
1952
1953 <sect1>em_load_driver<label id="em_load_driver"><p>
1954
1955 <quote>
1956 <descrip>
1957 <tag/Function/Load and initialize an extended memory driver.
1958 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1959 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1960 <tag/Description/Load an extended memory driver into memory and initialize
1961 it. The function returns an error code that tells if all this has been
1962 successful.
1963 <tag/Limits/<itemize>
1964 <item>Not all drivers are able to detect if the supported hardware is really
1965 present.
1966 <item>The function is only available as fastcall function, so it may only be
1967 used in presence of a prototype.
1968 <item>The driver is loaded by name, so currently you must know the type of
1969 extended memory that should be supported. There is no autodetect capability.
1970 </itemize>
1971 <tag/Availability/cc65
1972 <tag/See also/
1973 <ref id="em_unload" name="em_unload">
1974 <tag/Example/None.
1975 </descrip>
1976 </quote>
1977
1978
1979 <sect1>em_map<label id="em_map"><p>
1980
1981 <quote>
1982 <descrip>
1983 <tag/Function/Make a page of extended memory accessible.
1984 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1985 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1986 <tag/Description/The function maps one page of extended memory into linear
1987 memory and returns a pointer to the page frame. Depending on the hardware
1988 and driver, the data is either mapped into the address space or transfered
1989 into a buffer. If you don't need the actual contents of the page (for example
1990 because you're going to overwrite it completely), it is better to call
1991 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1992 data if it is possible to avoid that.
1993 <tag/Limits/<itemize>
1994 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1995 made any changes to the data in the window, call <tt/<ref id="em_commit"
1996 name="em_commit">/ first, or the changes are lost.
1997 <item>The function is only available as fastcall function, so it may only be
1998 used in presence of a prototype.
1999 <item>The function produces undefined results if no extended memory driver is
2000 loaded.
2001 </itemize>
2002 <tag/Availability/cc65
2003 <tag/See also/
2004 <ref id="em_commit" name="em_commit">,
2005 <ref id="em_load_driver" name="em_load_driver">,
2006 <ref id="em_use" name="em_use">
2007 <tag/Example/None.
2008 </descrip>
2009 </quote>
2010
2011
2012 <sect1>em_pagecount<label id="em_pagecount"><p>
2013
2014 <quote>
2015 <descrip>
2016 <tag/Function/Return the number of available extended memory pages.
2017 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2018 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
2019 <tag/Description/The function returns the size of the extended memory supported
2020 by the driver in 256 byte pages.
2021 <tag/Limits/<itemize>
2022 <item>The function returns zero if no extended memory driver is loaded.
2023 <item>The function may return zero if the supported hardware was not detected.
2024 </itemize>
2025 <tag/Availability/cc65
2026 <tag/See also/
2027 <ref id="em_load_driver" name="em_load_driver">
2028 <tag/Example/None.
2029 </descrip>
2030 </quote>
2031
2032
2033 <sect1>em_uninstall<label id="em_uninstall"><p>
2034
2035 <quote>
2036 <descrip>
2037 <tag/Function/Uninstall an already loaded extended memory driver.
2038 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2039 <tag/Declaration/<tt/unsigned char __fastcall__ em_install (void);/
2040 <tag/Description/The function uninstalls an already loaded extended memory
2041 driver but doesn't remove it from memory.
2042 <tag/Limits/<itemize>
2043 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
2044 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
2045 should be used instead of <tt/em_uninstall/ so the driver is also removed
2046 from memory.
2047 <item>The function is only available as fastcall function, so it may only be
2048 used in presence of a prototype.
2049 </itemize>
2050 <tag/Availability/cc65
2051 <tag/See also/
2052 <ref id="em_install" name="em_install">,
2053 <ref id="em_load_driver" name="em_load_driver">,
2054 <ref id="em_unload" name="em_unload">
2055 <tag/Example/None.
2056 </descrip>
2057 </quote>
2058
2059
2060 <sect1>em_unload<label id="em_unload"><p>
2061
2062 <quote>
2063 <descrip>
2064 <tag/Function/Unload an extended memory driver.
2065 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2066 <tag/Declaration/<tt/unsigned char __fastcall__ em_unload (void);/
2067 <tag/Description/The function unloads a loaded extended memory driver and
2068 frees all memory allocated for the driver.
2069 <tag/Limits/<itemize>
2070 <item>The function does nothing if no driver is loaded.
2071 </itemize>
2072 <tag/Availability/cc65
2073 <tag/See also/
2074 <ref id="em_load_driver" name="em_load_driver">
2075 <tag/Example/None.
2076 </descrip>
2077 </quote>
2078
2079
2080 <sect1>em_use<label id="em_use"><p>
2081
2082 <quote>
2083 <descrip>
2084 <tag/Function/Prepare an extended memory page for use.
2085 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2086 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
2087 <tag/Description/The function maps one page of extended memory into linear
2088 memory and returns a pointer to the page frame. This function is similar to
2089 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
2090 actual memory window in the assumption that the existing data is wrong or
2091 will get overwritten.
2092 <tag/Limits/<itemize>
2093 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
2094 made any changes to the data in the window, call <tt/<ref id="em_commit"
2095 name="em_commit">/ first, or the changes are lost.
2096 <item>The function is only available as fastcall function, so it may only be
2097 used in presence of a prototype.
2098 <item>The function produces undefined results if no extended memory driver is
2099 loaded.
2100 </itemize>
2101 <tag/Availability/cc65
2102 <tag/See also/
2103 <ref id="em_commit" name="em_commit">,
2104 <ref id="em_load_driver" name="em_load_driver">,
2105 <ref id="em_map" name="em_map">
2106 <tag/Example/None.
2107 </descrip>
2108 </quote>
2109
2110
2111 <sect1>exit<label id="exit"><p>
2112
2113 <quote>
2114 <descrip>
2115 <tag/Function/Terminate the program.
2116 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2117 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
2118 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
2119 return code of the program. Before termination, all files are closed, buffered
2120 output is written and any functions registered with <tt/<ref id="atexit"
2121 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
2122 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
2123 name="stdlib.h">/.
2124 <tag/Limits/<itemize>
2125 <item>The function is only available as fastcall function, so it may only
2126 be used in presence of a prototype.
2127 <item>It depends on the host machine if the program return code can be
2128 evaluated or is ignored.
2129 </itemize>
2130 <tag/Availability/ISO 9899
2131 <tag/See also/
2132 <ref id="abort" name="abort">,
2133 <ref id="exit" name="exit">
2134 <tag/Example/None.
2135 </descrip>
2136 </quote>
2137
2138
2139 <sect1>exec<label id="exec"><p>
2140
2141 <quote>
2142 <descrip>
2143 <tag/Function/Execute a program file.
2144 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
2145 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
2146 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
2147 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
2148 then loading and starting the program named in the first argument, passing
2149 the command line specified as second argument. Instead of an empty string,
2150 a <tt/NULL/ pointer may be passed as second parameter.
2151 On success, the function does not return. On failure, -1 is returned and
2152 <tt/errno/ contains an error code.
2153 <tag/Limits/<itemize>
2154 <item>The function is only available as fastcall function, so it may only
2155 be used in presence of a prototype.
2156 <item>On most platforms, the function needs to copy a small stub loader to
2157 some memory area outside the program space. This may collide with other
2158 programs. See the platform specific docs on this.
2159 <item>Because it is necessary to terminate the running program before the
2160 memory can be reused to load the new one, there is a high chance that the
2161 function may not be able to return on errors.
2162 <item>The command line is passed to the new program in the same way as cc65
2163 programs expect the command line. If the new program is not a cc65 generated
2164 program, it may not be able to read it.
2165 </itemize>
2166 <tag/Availability/cc65
2167 <tag/See also/
2168 <ref id="exit" name="exit">
2169 <tag/Example/None.
2170 </descrip>
2171 </quote>
2172
2173
2174 <sect1>fast<label id="fast"><p>
2175
2176 <quote>
2177 <descrip>
2178 <tag/Function/Switch the C128 into 2MHz mode.
2179 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2180 <tag/Declaration/<tt/void fast (void);/
2181 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
2182 will nearly double the speed compared to slow mode.
2183 <tag/Limits/<itemize>
2184 <item>The function is specific to the C128.
2185 <item>2MHz clock will not work in 40 column mode.
2186 </itemize>
2187 <tag/Availability/C128
2188 <tag/See also/
2189 <ref id="slow" name="slow">,
2190 <ref id="toggle_videomode" name="toggle_videomode">,
2191 <ref id="videomode" name="videomode">
2192 <tag/Example/None.
2193 </descrip>
2194 </quote>
2195
2196
2197 <sect1>feof<label id="feof"><p>
2198
2199 <quote>
2200 <descrip>
2201 <tag/Function/Return the end-of-file indicator of a stream.
2202 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2203 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
2204 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
2205 <tt/f/, and returns a non zero value if it is set.
2206 <tag/Limits/<itemize>
2207 <item>The indicator is set only after a read past the end of a file is
2208 attempted.
2209 <item>The function is only available as fastcall function, so it may only be
2210 used in presence of a prototype.
2211 </itemize>
2212 <tag/Availability/ISO 9899
2213 <tag/See also/
2214 <ref id="feof" name="clearerr">,
2215 <ref id="ferror" name="ferror">
2216 <tag/Example/None.
2217 </descrip>
2218 </quote>
2219
2220
2221 <sect1>ferror<label id="ferror"><p>
2222
2223 <quote>
2224 <descrip>
2225 <tag/Function/Return the error indicator of a stream.
2226 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2227 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
2228 <tag/Description/<tt/ferror/ tests the error indicator of the stream
2229 <tt/f/, and returns a non zero value if it is set.
2230 <tag/Limits/<itemize>
2231 <item>The function is only available as fastcall function, so it may only be
2232 used in presence of a prototype.
2233 </itemize>
2234 <tag/Availability/ISO 9899
2235 <tag/See also/
2236 <ref id="feof" name="clearerr">,
2237 <ref id="ferror" name="feof">
2238 <tag/Example/None.
2239 </descrip>
2240 </quote>
2241
2242
2243 <sect1>fileno<label id="fileno"><p>
2244
2245 <quote>
2246 <descrip>
2247 <tag/Function/Return the file handle used by a stream.
2248 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2249 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
2250 <tag/Description/The <tt/fileno/ function returns the file handle used
2251 internally by a C stream. This file handle (an integer) can be used as a
2252 handle for the POSIX input/output functions.
2253 <tag/Limits/<itemize>
2254 <item>The function is only available as fastcall function, so it may only be
2255 used in presence of a prototype.
2256 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
2257 file may have unpredictable results.
2258 </itemize>
2259 <tag/Availability/POSIX 1003.1
2260 <tag/See also/
2261 <ref id="creat" name="creat">,
2262 <ref id="open" name="open"> <!-- , -->
2263 <!-- <ref id="read" name="read">, -->
2264 <!-- <ref id="write" name="write"> -->
2265 <tag/Example/None.
2266 </descrip>
2267 </quote>
2268
2269
2270 <sect1>free<label id="free"><p>
2271
2272 <quote>
2273 <descrip>
2274 <tag/Function/Free a block of dynamic memory.
2275 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2276 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
2277 <tag/Description/Free a block of dynamic memory previously allocated with
2278 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
2279 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
2280 pointer is <tt/NULL/, no action is performed.
2281 <tag/Limits/
2282 <itemize>
2283 <item>Passing an already free'd block to <tt/free/ again will cause undefined
2284 behaviour and may crash your program.
2285 <item>The function is only available as fastcall function, so it may only
2286 be used in presence of a prototype.
2287 </itemize>
2288 <tag/Availability/ISO 9899
2289 <tag/See also/
2290 <ref id="_heapadd" name="_heapadd">,
2291 <ref id="_heapblocksize" name="_heapblocksize">,
2292 <ref id="_heapmaxavail" name="_heapmaxavail">,
2293 <ref id="_heapmemavail" name="_heapmemavail">,
2294 <ref id="calloc" name="calloc">,
2295 <ref id="malloc" name="malloc">,
2296 <ref id="realloc" name="realloc">
2297 <tag/Example/None.
2298 </descrip>
2299 </quote>
2300
2301
2302 <sect1>get_ostype<label id="get_ostype"><p>
2303
2304 <quote>
2305 <descrip>
2306 <tag/Function/The function returns the operating system, the program runs on.
2307 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
2308 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
2309 <tag/Declaration/<tt/unsigned char get_ostype (void);/
2310 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
2311 all supported targets. If it exists, it returns a number that identifies the
2312 operating system or machine type, the program runs on. The machine dependent
2313 header files define constants that can be used to check the return code.
2314 <tag/Limits/<itemize>
2315 <item>The function does not exist on all platforms.
2316 <item>The return codes are platform dependent.
2317 </itemize>
2318 <tag/Availability/cc65 (not all platforms)
2319 <tag/Example/None.
2320 </descrip>
2321 </quote>
2322
2323
2324 <sect1>getcpu<label id="getcpu"><p>
2325
2326 <quote>
2327 <descrip>
2328 <tag/Function/Determine on which CPU the program is running.
2329 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2330 <tag/Declaration/<tt/unsigned char getcpu (void);/
2331 <tag/Description/The function checks on which CPU the code is running. It
2332 returns one of the constants<itemize>
2333 <item><tt/CPU_6502/
2334 <item><tt/CPU_65C02/
2335 <item><tt/CPU_65816/
2336 </itemize>
2337 <tag/Limits/<itemize>
2338 <item>Other, more exotic CPU types are not disinguished.
2339 </itemize>
2340 <tag/Availability/cc65
2341 <tag/Example/None.
2342 </descrip>
2343 </quote>
2344
2345
2346 <sect1>getenv<label id="getenv"><p>
2347
2348 <quote>
2349 <descrip>
2350 <tag/Function/Return a value from the environment.
2351 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2352 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
2353 <tag/Description/The function searches the environment for an entry that
2354 matches <tt/name/ and returns its value. The environment consists of a list
2355 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
2356 returns <tt/NULL/.
2357 <tag/Limits/<itemize>
2358 <item>What exactly is stored in the environment depends on the machine the
2359 program is running on.
2360 <item>The function is only available as fastcall function, so it may only
2361 be used in presence of a prototype.
2362 </itemize>
2363 <tag/Availability/ISO 9899
2364 <tag/Example/None.
2365 </descrip>
2366 </quote>
2367
2368
2369 <sect1>getopt<label id="getopt"><p>
2370
2371 <quote>
2372 <descrip>
2373 <tag/Function/Parse command line options.
2374 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
2375 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
2376 const char* optstring);/
2377 <tag/Description/The function parses command line arguments, <tt/argc/ and
2378 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
2379 is a string that contains command line option characters. If a character in
2380 <tt/optstring/ is followed by a colon, the option requires an argument. An
2381 option on the command line is recognized if it is one of the option characters
2382 preceeded by a '-'.
2383 <tt/getopt/ must be called repeatedly. It will return each option character
2384 found on the command line and <tt/EOF/ (-1) if there is no other option. An
2385 option argument is placed in <tt/optarg/, the index of the next element on the
2386 command line to be processed is placed in <tt/optind/.
2387 <tag/Limits/<itemize>
2388 <item>The implementation will not reorder options. A non option on the command
2389 line will terminate option processing. All remaining arguments are not
2390 recognized as options, even if the start with a '-' character.
2391 <item>The function is only available as fastcall function, so it may only
2392 be used in presence of a prototype.
2393 </itemize>
2394 <tag/Availability/POSIX.2
2395 <tag/Example/None.
2396 </descrip>
2397 </quote>
2398
2399
2400 <sect1>gotox<label id="gotox"><p>
2401
2402 <quote>
2403 <descrip>
2404 <tag/Function/Move the text mode cursor to a new X position.
2405 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2406 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
2407 <tag/Description/The function moves the text mode cursor to the specified X
2408 position while leaving the Y position untouched. The leftmost position on the
2409 screen has the coordinate 0.
2410 <tag/Limits/<itemize>
2411 <item>The function is only available as fastcall function, so it may
2412 only be used in presence of a prototype.
2413 <item>Invalid values for the X position (out of screen coordinates) may
2414 lead to undefined behaviour.
2415 </itemize>
2416 <tag/Availability/cc65
2417 <tag/See also/
2418 <ref id="gotoy" name="gotoy">,
2419 <ref id="gotoxy" name="gotoxy">,
2420 <ref id="wherex" name="wherex">,
2421 <ref id="wherey" name="wherey">
2422 <tag/Example/None.
2423 </descrip>
2424 </quote>
2425
2426
2427 <sect1>gotoxy<label id="gotoxy"><p>
2428
2429 <quote>
2430 <descrip>
2431 <tag/Function/Move the text mode cursor to a new position.
2432 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2433 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
2434 <tag/Description/The function moves the text mode cursor to the specified
2435 position. The leftmost position on the screen has the X coordinate 0, the
2436 topmost line has the Y coordinate 0.
2437 <tag/Limits/<itemize>
2438 <item>The function is only available as fastcall function, so it may only be
2439 used in presence of a prototype.
2440 <item>Invalid values for any of both coordinates (out of screen positions) may
2441 lead to undefined behaviour.
2442 </itemize>
2443 <tag/Availability/cc65
2444 <tag/See also/
2445 <ref id="gotox" name="gotox">,
2446 <ref id="gotoy" name="gotoy">,
2447 <ref id="wherex" name="wherex">,
2448 <ref id="wherey" name="wherey">
2449 <tag/Example/None.
2450 </descrip>
2451 </quote>
2452
2453
2454 <sect1>gotoy<label id="gotoy"><p>
2455
2456 <quote>
2457 <descrip>
2458 <tag/Function/Move the text mode cursor to a new Y position.
2459 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2460 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
2461 <tag/Description/The function moves the text mode cursor to the specified Y
2462 position while leaving the X position untouched. The uppermost position on the
2463 screen has the coordinate 0.
2464 <tag/Limits/<itemize>
2465 <item>The function is only available as fastcall function, so it may
2466 only be used in presence of a prototype.
2467 <item>Invalid values for the Y position (out of screen coordinates) may lead
2468 to undefined behaviour.
2469 </itemize>
2470 <tag/Availability/cc65
2471 <tag/See also/
2472 <ref id="gotox" name="gotox">,
2473 <ref id="gotoxy" name="gotoxy">,
2474 <ref id="wherex" name="wherex">,
2475 <ref id="wherey" name="wherey">
2476 <tag/Example/None.
2477 </descrip>
2478 </quote>
2479
2480
2481 <sect1>isalnum<label id="isalnum"><p>
2482
2483 <quote>
2484 <descrip>
2485 <tag/Function/Check if a given character is a letter or digit.
2486 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2487 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
2488 <tag/Description/The function returns a non zero value if the given argument
2489 is a letter or digit. The return value is zero if the character is anything
2490 else.
2491 <tag/Limits/<itemize>
2492 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2493 inline sequence generated by the macro will not work correctly for values
2494 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2495 this range. The non inline function may be accessed by <tt/#undef/'ing
2496 the macro.
2497 <item>When compiling without <tt/-Os/, the function is only available as
2498 fastcall function, so it may only be used in presence of a prototype.
2499 </itemize>
2500 <tag/Availability/ISO 9899
2501 <tag/See also/
2502 <ref id="isalpha" name="isalpha">,
2503 <ref id="isascii" name="isascii">,
2504 <ref id="isblank" name="isblank">,
2505 <ref id="iscntrl" name="iscntrl">,
2506 <ref id="isdigit" name="isdigit">,
2507 <ref id="isgraph" name="isgraph">,
2508 <ref id="islower" name="islower">,
2509 <ref id="isprint" name="isprint">,
2510 <ref id="ispunct" name="ispunct">,
2511 <ref id="isspace" name="isspace">,
2512 <ref id="isupper" name="isupper">,
2513 <ref id="isxdigit" name="isxdigit">
2514 <tag/Example/None.
2515 </descrip>
2516 </quote>
2517
2518
2519 <sect1>isalpha<label id="isalpha"><p>
2520
2521 <quote>
2522 <descrip>
2523 <tag/Function/Check if a given character is a letter.
2524 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2525 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
2526 <tag/Description/The function returns a non zero value if the given argument
2527 is a letter. The return value is zero if the character is anything else.
2528 <tag/Limits/<itemize>
2529 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2530 inline sequence generated by the macro will not work correctly for values
2531 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2532 this range. The non inline function may be accessed by <tt/#undef/'ing the
2533 macro.
2534 <item>When compiling without <tt/-Os/, the function is only available as
2535 fastcall function, so it may only be used in presence of a prototype.
2536 </itemize>
2537 <tag/Availability/ISO 9899
2538 <tag/See also/
2539 <ref id="isalnum" name="isalnum">,
2540 <ref id="isascii" name="isascii">,
2541 <ref id="isblank" name="isblank">,
2542 <ref id="iscntrl" name="iscntrl">,
2543 <ref id="isdigit" name="isdigit">,
2544 <ref id="isgraph" name="isgraph">,
2545 <ref id="islower" name="islower">,
2546 <ref id="isprint" name="isprint">,
2547 <ref id="ispunct" name="ispunct">,
2548 <ref id="isspace" name="isspace">,
2549 <ref id="isupper" name="isupper">,
2550 <ref id="isxdigit" name="isxdigit">
2551 <tag/Example/None.
2552 </descrip>
2553 </quote>
2554
2555
2556 <sect1>isascii<label id="isascii"><p>
2557
2558 <quote>
2559 <descrip>
2560 <tag/Function/Check if a given character is in the ASCII (0..127) range.
2561 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2562 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
2563 <tag/Description/The function returns a non zero value if the given argument
2564 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
2565 <tag/Limits/<itemize>
2566 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2567 inline sequence generated by the macro will not work correctly for values
2568 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2569 this range. The non inline function may be accessed by <tt/#undef/'ing the
2570 macro.
2571 <item>When compiling without <tt/-Os/, the function is only available as
2572 fastcall function, so it may only be used in presence of a prototype.
2573 </itemize>
2574 <tag/Availability/ISO 9899
2575 <tag/See also/
2576 <ref id="isalnum" name="isalnum">,
2577 <ref id="isalpha" name="isalpha">,
2578 <ref id="isblank" name="isblank">,
2579 <ref id="iscntrl" name="iscntrl">,
2580 <ref id="isdigit" name="isdigit">,
2581 <ref id="isgraph" name="isgraph">,
2582 <ref id="islower" name="islower">,
2583 <ref id="isprint" name="isprint">,
2584 <ref id="ispunct" name="ispunct">,
2585 <ref id="isspace" name="isspace">,
2586 <ref id="isupper" name="isupper">,
2587 <ref id="isxdigit" name="isxdigit">
2588 <tag/Example/None.
2589 </descrip>
2590 </quote>
2591
2592
2593 <sect1>isblank<label id="isblank"><p>
2594
2595 <quote>
2596 <descrip>
2597 <tag/Function/Check if a given character is a space or tab.
2598 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2599 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
2600 <tag/Description/The function returns a non zero value if the given argument
2601 is a space or tab character. The return value is zero if the character is
2602 anything else.
2603 <tag/Limits/<itemize>
2604 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2605 inline sequence generated by the macro will not work correctly for values
2606 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2607 this range. The non inline function may be accessed by <tt/#undef/'ing the
2608 macro.
2609 <item>When compiling without <tt/-Os/, the function is only available as
2610 fastcall function, so it may only be used in presence of a prototype.
2611 </itemize>
2612 <tag/Availability/cc65
2613 <tag/See also/
2614 <ref id="isalnum" name="isalnum">,
2615 <ref id="isalpha" name="isalpha">,
2616 <ref id="isascii" name="isascii">,
2617 <ref id="iscntrl" name="iscntrl">,
2618 <ref id="isdigit" name="isdigit">,
2619 <ref id="isgraph" name="isgraph">,
2620 <ref id="islower" name="islower">,
2621 <ref id="isprint" name="isprint">,
2622 <ref id="ispunct" name="ispunct">,
2623 <ref id="isspace" name="isspace">,
2624 <ref id="isupper" name="isupper">,
2625 <ref id="isxdigit" name="isxdigit">
2626 <tag/Example/None.
2627 </descrip>
2628 </quote>
2629
2630
2631 <sect1>iscntrl<label id="iscntrl"><p>
2632
2633 <quote>
2634 <descrip>
2635 <tag/Function/Check if a given character is a control character.
2636 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2637 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
2638 <tag/Description/The function returns a non zero value if the given argument
2639 is a control character. The return value is zero if the character is anything
2640 else.
2641 <tag/Limits/<itemize>
2642 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2643 inline sequence generated by the macro will not work correctly for values
2644 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2645 this range. The non inline function may be accessed by <tt/#undef/'ing the
2646 macro.
2647 <item>When compiling without <tt/-Os/, the function is only available as
2648 fastcall function, so it may only be used in presence of a prototype.
2649 </itemize>
2650 <tag/Availability/ISO 9899
2651 <tag/See also/
2652 <ref id="isalnum" name="isalnum">,
2653 <ref id="isalpha" name="isalpha">,
2654 <ref id="isascii" name="isascii">,
2655 <ref id="isblank" name="isblank">,
2656 <ref id="isdigit" name="isdigit">,
2657 <ref id="isgraph" name="isgraph">,
2658 <ref id="islower" name="islower">,
2659 <ref id="isprint" name="isprint">,
2660 <ref id="ispunct" name="ispunct">,
2661 <ref id="isspace" name="isspace">,
2662 <ref id="isupper" name="isupper">,
2663 <ref id="isxdigit" name="isxdigit">
2664 <tag/Example/None.
2665 </descrip>
2666 </quote>
2667
2668
2669 <sect1>isdigit<label id="isdigit"><p>
2670
2671 <quote>
2672 <descrip>
2673 <tag/Function/Check if a given character is a digit.
2674 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2675 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
2676 <tag/Description/The function returns a non zero value if the given argument
2677 is a digit. The return value is zero if the character is anything else.
2678 <tag/Limits/<itemize>
2679 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2680 inline sequence generated by the macro will not work correctly for values
2681 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2682 this range. The non inline function may be accessed by <tt/#undef/'ing the
2683 macro.
2684 <item>When compiling without <tt/-Os/, the function is only available as
2685 fastcall function, so it may only be used in presence of a prototype.
2686 </itemize>
2687 <tag/Availability/ISO 9899
2688 <tag/See also/
2689 <ref id="isalnum" name="isalnum">,
2690 <ref id="isalpha" name="isalpha">,
2691 <ref id="isascii" name="isascii">,
2692 <ref id="isblank" name="isblank">,
2693 <ref id="iscntrl" name="iscntrl">,
2694 <ref id="isgraph" name="isgraph">,
2695 <ref id="islower" name="islower">,
2696 <ref id="isprint" name="isprint">,
2697 <ref id="ispunct" name="ispunct">,
2698 <ref id="isspace" name="isspace">,
2699 <ref id="isupper" name="isupper">,
2700 <ref id="isxdigit" name="isxdigit">
2701 <tag/Example/None.
2702 </descrip>
2703 </quote>
2704
2705
2706 <sect1>isgraph<label id="isgraph"><p>
2707
2708 <quote>
2709 <descrip>
2710 <tag/Function/Check if a given character is a printable character (except
2711 space).
2712 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2713 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
2714 <tag/Description/The function returns a non zero value if the given argument
2715 is a printable character with the exception of space. The return value is zero
2716 if the character is anything else.
2717 <tag/Limits/<itemize>
2718 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2719 inline sequence generated by the macro will not work correctly for values
2720 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2721 this range. The non inline function may be accessed by <tt/#undef/'ing the
2722 macro.
2723 <item>When compiling without <tt/-Os/, the function is only available as
2724 fastcall function, so it may only be used in presence of a prototype.
2725 </itemize>
2726 <tag/Availability/ISO 9899
2727 <tag/See also/
2728 <ref id="isalnum" name="isalnum">,
2729 <ref id="isalpha" name="isalpha">,
2730 <ref id="isascii" name="isascii">,
2731 <ref id="isblank" name="isblank">,
2732 <ref id="iscntrl" name="iscntrl">,
2733 <ref id="isdigit" name="isdigit">,
2734 <ref id="islower" name="islower">,
2735 <ref id="isprint" name="isprint">,
2736 <ref id="ispunct" name="ispunct">,
2737 <ref id="isspace" name="isspace">,
2738 <ref id="isupper" name="isupper">,
2739 <ref id="isxdigit" name="isxdigit">
2740 <tag/Example/None.
2741 </descrip>
2742 </quote>
2743
2744
2745 <sect1>islower<label id="islower"><p>
2746
2747 <quote>
2748 <descrip>
2749 <tag/Function/Check if a given character is a lower case letter.
2750 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2751 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
2752 <tag/Description/The function returns a non zero value if the given argument
2753 is a lower case letter. The return value is zero if the character is anything
2754 else.
2755 <tag/Limits/<itemize>
2756 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2757 inline sequence generated by the macro will not work correctly for values
2758 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2759 this range. The non inline function may be accessed by <tt/#undef/'ing the
2760 macro.
2761 <item>When compiling without <tt/-Os/, the function is only available as
2762 fastcall function, so it may only be used in presence of a prototype.
2763 </itemize>
2764 <tag/Availability/ISO 9899
2765 <tag/See also/
2766 <ref id="isalnum" name="isalnum">,
2767 <ref id="isalpha" name="isalpha">,
2768 <ref id="isascii" name="isascii">,
2769 <ref id="isblank" name="isblank">,
2770 <ref id="iscntrl" name="iscntrl">,
2771 <ref id="isdigit" name="isdigit">,
2772 <ref id="isgraph" name="isgraph">,
2773 <ref id="isprint" name="isprint">,
2774 <ref id="ispunct" name="ispunct">,
2775 <ref id="isspace" name="isspace">,
2776 <ref id="isupper" name="isupper">,
2777 <ref id="isxdigit" name="isxdigit">
2778 <tag/Example/None.
2779 </descrip>
2780 </quote>
2781
2782
2783 <sect1>isprint<label id="isprint"><p>
2784
2785 <quote>
2786 <descrip>
2787 <tag/Function/Check if a given character is a printable character.
2788 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2789 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
2790 <tag/Description/The function returns a non zero value if the given argument
2791 is a printable character (this includes the space character). The return value
2792 is zero if the character is anything else.
2793 <tag/Limits/<itemize>
2794 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2795 inline sequence generated by the macro will not work correctly for values
2796 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2797 this range. The non inline function may be accessed by <tt/#undef/'ing the
2798 macro.
2799 <item>When compiling without <tt/-Os/, the function is only available as
2800 fastcall function, so it may only be used in presence of a prototype.
2801 </itemize>
2802 <tag/Availability/ISO 9899
2803 <tag/See also/
2804 <ref id="isalnum" name="isalnum">,
2805 <ref id="isalpha" name="isalpha">,
2806 <ref id="isascii" name="isascii">,
2807 <ref id="isblank" name="isblank">,
2808 <ref id="iscntrl" name="iscntrl">,
2809 <ref id="isdigit" name="isdigit">,
2810 <ref id="isgraph" name="isgraph">,
2811 <ref id="islower" name="islower">,
2812 <ref id="ispunct" name="ispunct">,
2813 <ref id="isspace" name="isspace">,
2814 <ref id="isupper" name="isupper">,
2815 <ref id="isxdigit" name="isxdigit">
2816 <tag/Example/None.
2817 </descrip>
2818 </quote>
2819
2820
2821 <sect1>ispunct<label id="ispunct"><p>
2822
2823 <quote>
2824 <descrip>
2825 <tag/Function/Check if a given character is a printable character but not a
2826 space or an alphanumeric character.
2827 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2828 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2829 <tag/Description/The function returns a non zero value if the given argument
2830 is a printable character, but not a space or anything alphanumeric. The return
2831 value is zero if the character is anything else.
2832 <tag/Limits/<itemize>
2833 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2834 inline sequence generated by the macro will not work correctly for values
2835 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2836 this range. The non inline function may be accessed by <tt/#undef/'ing the
2837 macro.
2838 <item>When compiling without <tt/-Os/, the function is only available as
2839 fastcall function, so it may only be used in presence of a prototype.
2840 </itemize>
2841 <tag/Availability/ISO 9899
2842 <tag/See also/
2843 <ref id="isalnum" name="isalnum">,
2844 <ref id="isalpha" name="isalpha">,
2845 <ref id="isascii" name="isascii">,
2846 <ref id="isblank" name="isblank">,
2847 <ref id="iscntrl" name="iscntrl">,
2848 <ref id="isdigit" name="isdigit">,
2849 <ref id="isgraph" name="isgraph">,
2850 <ref id="islower" name="islower">,
2851 <ref id="isprint" name="isprint">,
2852 <ref id="isspace" name="isspace">,
2853 <ref id="isupper" name="isupper">,
2854 <ref id="isxdigit" name="isxdigit">
2855 <tag/Example/None.
2856 </descrip>
2857 </quote>
2858
2859
2860 <sect1>isspace<label id="isspace"><p>
2861
2862 <quote>
2863 <descrip>
2864 <tag/Function/Check if a given character is a a white-space character.
2865 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2866 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2867 <tag/Description/The function returns a non zero value if the given argument
2868 is a white space character. The return value is zero if the character is
2869 anything else. The standard white space characters are: space, formfeed ('\f'),
2870 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2871 ('\v').
2872 <tag/Limits/<itemize>
2873 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2874 inline sequence generated by the macro will not work correctly for values
2875 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2876 this range. The non inline function may be accessed by <tt/#undef/'ing the
2877 macro.
2878 <item>When compiling without <tt/-Os/, the function is only available as
2879 fastcall function, so it may only be used in presence of a prototype.
2880 </itemize>
2881 <tag/Availability/ISO 9899
2882 <tag/See also/
2883 <ref id="isalnum" name="isalnum">,
2884 <ref id="isalpha" name="isalpha">,
2885 <ref id="isascii" name="isascii">,
2886 <ref id="isblank" name="isblank">,
2887 <ref id="iscntrl" name="iscntrl">,
2888 <ref id="isdigit" name="isdigit">,
2889 <ref id="isgraph" name="isgraph">,
2890 <ref id="islower" name="islower">,
2891 <ref id="isprint" name="isprint">,
2892 <ref id="ispunct" name="ispunct">,
2893 <ref id="isupper" name="isupper">,
2894 <ref id="isxdigit" name="isxdigit">
2895 <tag/Example/None.
2896 </descrip>
2897 </quote>
2898
2899
2900 <sect1>isupper<label id="isupper"><p>
2901
2902 <quote>
2903 <descrip>
2904 <tag/Function/Check if a given character is an upper case letter.
2905 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2906 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2907 <tag/Description/The function returns a non zero value if the given argument
2908 is an upper case letter. The return value is zero if the character is anything
2909 else.
2910 <tag/Limits/<itemize>
2911 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2912 inline sequence generated by the macro will not work correctly for values
2913 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2914 this range. The non inline function may be accessed by <tt/#undef/'ing the
2915 macro.
2916 <item>When compiling without <tt/-Os/, the function is only available as
2917 fastcall function, so it may only be used in presence of a prototype.
2918 </itemize>
2919 <tag/Availability/ISO 9899
2920 <tag/See also/
2921 <ref id="isalnum" name="isalnum">,
2922 <ref id="isalpha" name="isalpha">,
2923 <ref id="isascii" name="isascii">,
2924 <ref id="isblank" name="isblank">,
2925 <ref id="iscntrl" name="iscntrl">,
2926 <ref id="isdigit" name="isdigit">,
2927 <ref id="isgraph" name="isgraph">,
2928 <ref id="islower" name="islower">,
2929 <ref id="isprint" name="isprint">,
2930 <ref id="ispunct" name="ispunct">,
2931 <ref id="isspace" name="isspace">,
2932 <ref id="isxdigit" name="isxdigit">
2933 <tag/Example/None.
2934 </descrip>
2935 </quote>
2936
2937
2938 <sect1>isxdigit<label id="isxdigit"><p>
2939
2940 <quote>
2941 <descrip>
2942 <tag/Function/Check if a given character is a hexadecimal digit.
2943 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2944 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2945 <tag/Description/The function returns a non zero value if the given argument
2946 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
2947 character is anything else.
2948 <tag/Limits/<itemize>
2949 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2950 inline sequence generated by the macro will not work correctly for values
2951 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2952 this range. The non inline function may be accessed by <tt/#undef/'ing the
2953 macro.
2954 <item>When compiling without <tt/-Os/, the function is only available as
2955 fastcall function, so it may only be used in presence of a prototype.
2956 </itemize>
2957 <tag/Availability/ISO 9899
2958 <tag/See also/
2959 <ref id="isalnum" name="isalnum">,
2960 <ref id="isalpha" name="isalpha">,
2961 <ref id="isascii" name="isascii">,
2962 <ref id="isblank" name="isblank">,
2963 <ref id="iscntrl" name="iscntrl">,
2964 <ref id="isdigit" name="isdigit">,
2965 <ref id="isgraph" name="isgraph">,
2966 <ref id="islower" name="islower">,
2967 <ref id="isprint" name="isprint">,
2968 <ref id="ispunct" name="ispunct">,
2969 <ref id="isspace" name="isspace">,
2970 <ref id="isupper" name="isupper">
2971 <tag/Example/None.
2972 </descrip>
2973 </quote>
2974
2975
2976 <sect1>itoa<label id="itoa"><p>
2977
2978 <quote>
2979 <descrip>
2980 <tag/Function/Convert an integer into a string.
2981 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2982 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2983 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2984 <tt/radix/ as the base.
2985 <tag/Limits/<itemize>
2986 <item>There are no provisions to prevent a buffer overflow.
2987 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2988 <item>The function is non standard, so it is not available in strict ANSI mode.
2989 You should probably use <tt/sprintf/ instead.
2990 <item>The function is only available as fastcall function, so it may only be
2991 used in presence of a prototype.
2992 </itemize>
2993 <tag/Availability/cc65
2994 <tag/See also/
2995 <ref id="atoi" name="atoi">,
2996 <ref id="atol" name="atol">,
2997 <ref id="ltoa" name="ltoa">,
2998 <ref id="ultoa" name="ultoa">,
2999 <ref id="utoa" name="utoa">
3000 <tag/Example/None.
3001 </descrip>
3002 </quote>
3003
3004
3005 <sect1>joy_count<label id="joy_count"><p>
3006
3007 <quote>
3008 <descrip>
3009 <tag/Function/Return the number of joysticks supported by the current driver.
3010 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3011 <tag/Declaration/<tt/unsigned char __fastcall__ joy_count (void);/
3012 <tag/Description/The function returns a the number of joysticks supported
3013 by the current joystick driver.
3014 <tag/Limits/<itemize>
3015 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3016 name="joy_load_driver"> before calling this function.
3017 <item>The function returns the number of joysticks supported by the driver.
3018 There's no way to check for the number of actually connected joysticks.
3019 <item>The function is only available as fastcall function, so it may only be
3020 used in presence of a prototype.
3021 </itemize>
3022 <tag/Availability/cc65
3023 <tag/See also/
3024 <ref id="joy_load_driver" name="joy_load_driver">,
3025 <ref id="joy_read" name="joy_read">
3026 <tag/Example/None.
3027 </descrip>
3028 </quote>
3029
3030
3031 <sect1>joy_install<label id="joy_install"><p>
3032
3033 <quote>
3034 <descrip>
3035 <tag/Function/Install an already loaded driver and return an error code.
3036 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3037 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
3038 <tag/Description/The function installs a driver that was already loaded into
3039 memory (or linked statically to the program). It returns an error code
3040 (<tt/JOY_ERR_OK/ in case of success).
3041 <tag/Limits/<itemize>
3042 <item>The function is only available as fastcall function, so it may only be
3043 used in presence of a prototype.
3044 </itemize>
3045 <tag/Availability/cc65
3046 <tag/See also/
3047 <ref id="joy_load_driver" name="joy_load_driver">,
3048 <ref id="joy_uninstall" name="joy_uninstall">,
3049 <ref id="joy_unload" name="joy_unload">
3050 <tag/Example/None.
3051 </descrip>
3052 </quote>
3053
3054
3055 <sect1>joy_load_driver<label id="joy_load_driver"><p>
3056
3057 <quote>
3058 <descrip>
3059 <tag/Function/Load a driver from disk and install it.
3060 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3061 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
3062 <tag/Description/The function loads a driver with the given name from disk
3063 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
3064 driver was successfully loaded and installed.
3065 <tag/Limits/<itemize>
3066 <item>The function is only available as fastcall function, so it may only be
3067 used in presence of a prototype.
3068 </itemize>
3069 <tag/Availability/cc65
3070 <tag/See also/
3071 <ref id="joy_install" name="joy_install">,
3072 <ref id="joy_uninstall" name="joy_uninstall">,
3073 <ref id="joy_unload" name="joy_unload">
3074 <tag/Example/None.
3075 </descrip>
3076 </quote>
3077
3078
3079 <sect1>joy_read<label id="joy_read"><p>
3080
3081 <quote>
3082 <descrip>
3083 <tag/Function/Read the status of a joystick.
3084 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3085 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
3086 <tag/Description/The function reads the status bits for a joystick. The number
3087 of the joystick is passed as parameter. The result may be examined by using one
3088 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
3089 <tag/Limits/<itemize>
3090 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3091 name="joy_load_driver"> before calling this function.
3092 <item>The function is only available as fastcall function, so it may only be
3093 used in presence of a prototype.
3094 </itemize>
3095 <tag/Availability/cc65
3096 <tag/See also/
3097 <ref id="joy_count" name="joy_count">,
3098 <ref id="joy_load_driver" name="joy_load_driver">,
3099 <ref id="joy_unload" name="joy_unload">
3100 <tag/Example/None.
3101 </descrip>
3102 </quote>
3103
3104
3105 <sect1>joy_uninstall<label id="joy_uninstall"><p>
3106
3107 <quote>
3108 <descrip>
3109 <tag/Function/Uninstall the current joystick driver.
3110 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3111 <tag/Declaration/<tt/unsigned char __fastcall__ joy_uninstall (void);/
3112 <tag/Description/The function uninstalls the currently installed joystick
3113 driver. It does not remove the driver from memory. The function returns an
3114 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
3115 <tag/Limits/<itemize>
3116 <item>A joystick driver must be installed using <ref id="joy_install"
3117 name="joy_install"> before calling this function.
3118 <item>The function is only available as fastcall function, so it may only be
3119 used in presence of a prototype.
3120 </itemize>
3121 <tag/Availability/cc65
3122 <tag/See also/
3123 <ref id="joy_install" name="joy_install">,
3124 <ref id="joy_load_driver" name="joy_load_driver">,
3125 <ref id="joy_unload" name="joy_unload">
3126 <tag/Example/None.
3127 </descrip>
3128 </quote>
3129
3130
3131 <sect1>joy_unload<label id="joy_unload"><p>
3132
3133 <quote>
3134 <descrip>
3135 <tag/Function/Uninstall, then unload the current joystick driver.
3136 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3137 <tag/Declaration/<tt/unsigned char __fastcall__ joy_unload (void);/
3138 <tag/Description/The function uninstalls the currently installed joystick
3139 driver and removes it from memory. An error code is returned, which is
3140 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
3141 <tag/Limits/<itemize>
3142 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3143 name="joy_load_driver"> before calling this function.
3144 <item>The function is only available as fastcall function, so it may only be
3145 used in presence of a prototype.
3146 </itemize>
3147 <tag/Availability/cc65
3148 <tag/See also/
3149 <ref id="joy_load_driver" name="joy_load_driver">
3150 <tag/Example/None.
3151 </descrip>
3152 </quote>
3153
3154
3155 <sect1>kbhit<label id="kbhit"><p>
3156
3157 <quote>
3158 <descrip>
3159 <tag/Function/Check if there's a key waiting in the keyboard buffer.
3160 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3161 <tag/Declaration/<tt/unsigned char kbhit (void);/
3162 <tag/Description/The function returns a value of zero if there is no character
3163 waiting to be read from the keyboard. It returns non zero otherwise.
3164 <tag/Limits/<itemize>
3165 <item>If the system does not support a keyboard buffer (most systems
3166 do), the function is rather useless.
3167 </itemize>
3168 <tag/Availability/cc65
3169 <tag/See also/
3170 <ref id="cgetc" name="cgetc">,
3171 <ref id="cursor" name="cursor">
3172 <tag/Example/None.
3173 </descrip>
3174 </quote>
3175
3176
3177 <sect1>labs<label id="labs"><p>
3178
3179 <quote>
3180 <descrip>
3181 <tag/Function/Returns the absolute value of a long integer.
3182 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3183 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
3184 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
3185 the function.
3186 <tag/Limits/<itemize>
3187 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
3188 <item>The function is only available as fastcall function, so it may only be
3189 used in presence of a prototype.
3190 </itemize>
3191 <tag/Availability/ISO 9899
3192 <tag/See also/
3193 <ref id="abs" name="abs">
3194 <tag/Example/None.
3195 </descrip>
3196 </quote>
3197
3198
3199 <sect1>ltoa<label id="ltoa"><p>
3200
3201 <quote>
3202 <descrip>
3203 <tag/Function/Convert a long integer into a string.
3204 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3205 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
3206 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
3207 using <tt/radix/ as the base.
3208 <tag/Limits/<itemize>
3209 <item>There are no provisions to prevent a buffer overflow.
3210 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
3211 <item>The function is non standard, so it is not available in strict ANSI mode.
3212 You should probably use <tt/sprintf/ instead.
3213 <item>The function is only available as fastcall function, so it may only be
3214 used in presence of a prototype.
3215 </itemize>
3216 <tag/Availability/cc65
3217 <tag/See also/
3218 <ref id="atoi" name="atoi">,
3219 <ref id="atol" name="atol">,
3220 <ref id="itoa" name="itoa">,
3221 <ref id="ultoa" name="ultoa">,
3222 <ref id="utoa" name="utoa">
3223 <tag/Example/None.
3224 </descrip>
3225 </quote>
3226
3227
3228 <sect1>localeconv<label id="localeconv"><p>
3229
3230 <quote>
3231 <descrip>
3232 <tag/Function/Returns a pointer to the current locale structure.
3233 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3234 <tag/Declaration/<tt/struct lconv* localeconv (void);/
3235 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
3236 structure.
3237 <tag/Limits/<itemize>
3238 <item>cc65 supports only the "C" locale, so even after setting a new locale
3239 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
3240 always be the same.
3241 </itemize>
3242 <tag/Availability/ISO 9899
3243 <tag/See also/
3244 <ref id="setlocale" name="setlocale">
3245 <tag/Example/None.
3246 </descrip>
3247 </quote>
3248
3249
3250 <sect1>longjmp<label id="longjmp"><p>
3251
3252 <quote>
3253 <descrip>
3254 <tag/Function/Non local goto.
3255 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
3256 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
3257 <tag/Description/The <tt/longjmp/ function restores a program context from the
3258 data in <tt/buf/, which must have been set by a preceeding call to
3259 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
3260 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
3261 <tt/retval/.
3262 <tag/Limits/
3263 <itemize>
3264 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
3265 was called with a value of one.
3266 <item>The function is only available as fastcall function, so it may only
3267 be used in presence of a prototype.
3268 </itemize>
3269 <tag/Availability/ISO 9899
3270 <tag/See also/
3271 <ref id="setjmp" name="setjmp">
3272 <tag/Example/None.
3273 </descrip>
3274 </quote>
3275
3276
3277 <sect1>malloc<label id="malloc"><p>
3278
3279 <quote>
3280 <descrip>
3281 <tag/Function/Allocate dynamic memory.
3282 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3283 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
3284 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
3285 pointer to the allocated memory block. On error (not enough memory available),
3286 <tt/malloc/ returns <tt/NULL/.
3287 <tag/Limits/
3288 <itemize>
3289 <item>The function is only available as fastcall function, so it may only
3290 be used in presence of a prototype.
3291 </itemize>
3292 <tag/Availability/ISO 9899
3293 <tag/See also/
3294 <ref id="_heapadd" name="_heapadd">,
3295 <ref id="_heapblocksize" name="_heapblocksize">,
3296 <ref id="_heapmaxavail" name="_heapmaxavail">,
3297 <ref id="_heapmemavail" name="_heapmemavail">,
3298 <ref id="calloc" name="calloc">,
3299 <ref id="free" name="free">,
3300 <ref id="realloc" name="realloc">,
3301 <ref id="strdup" name="strdup">
3302 <tag/Example/None.
3303 </descrip>
3304 </quote>
3305
3306
3307 <sect1>memchr<label id="memchr"><p>
3308
3309 <quote>
3310 <descrip>
3311 <tag/Function/Search for a character in a block of raw memory.
3312 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3313 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
3314 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
3315 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
3316 that is of size <tt/count/. Upon completion, the function returns a pointer to
3317 the character found, or a null pointer if the character was not found.
3318 <tag/Limits/<itemize>
3319 <item>The function is only available as fastcall function, so it may only
3320 be used in presence of a prototype.
3321 </itemize>
3322 <tag/Availability/ISO 9899
3323 <tag/See also/
3324 <ref id="strchr" name="strchr">
3325 <tag/Example/None.
3326 </descrip>
3327 </quote>
3328
3329
3330 <sect1>memcmp<label id="memcmp"><p>
3331
3332 <quote>
3333 <descrip>
3334 <tag/Function/Compare two memory areas.
3335 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3336 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
3337 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
3338 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
3339 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
3340 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
3341 <tag/Limits/
3342 <itemize>
3343 <item>The function is only available as fastcall function, so it may only
3344 be used in presence of a prototype.
3345 </itemize>
3346 <tag/Availability/ISO 9899
3347 <tag/See also/
3348 <ref id="strcmp" name="strcmp">,
3349 <ref id="memmove" name="memmove">,
3350 <ref id="memset" name="memset">
3351 <tag/Example/None.
3352 </descrip>
3353 </quote>
3354
3355
3356 <sect1>memcpy<label id="memcpy"><p>
3357
3358 <quote>
3359 <descrip>
3360 <tag/Function/Copy a memory area.
3361 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3362 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
3363 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
3364 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3365 <tt/dest/.
3366 <tag/Limits/
3367 <itemize>
3368 <item>The result is undefined if the memory areas do overlap. Use
3369 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
3370 <item>The function is only available as fastcall function, so it may only
3371 be used in presence of a prototype.
3372 </itemize>
3373 <tag/Availability/ISO 9899
3374 <tag/See also/
3375 <ref id="_swap" name="_swap">,
3376 <ref id="memmove" name="memmove">,
3377 <ref id="memset" name="memset">
3378 <tag/Example/None.
3379 </descrip>
3380 </quote>
3381
3382
3383 <sect1>memmove<label id="memmove"><p>
3384
3385 <quote>
3386 <descrip>
3387 <tag/Function/Copy a memory area.
3388 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3389 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
3390 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
3391 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3392 <tt/dest/.
3393 <tag/Limits/
3394 <itemize>
3395 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
3396 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
3397 <item>The function is only available as fastcall function, so it may only
3398 be used in presence of a prototype.
3399 </itemize>
3400 <tag/Availability/ISO 9899
3401 <tag/See also/
3402 <ref id="_swap" name="_swap">,
3403 <ref id="memcpy" name="memcpy">,
3404 <ref id="memset" name="memset">
3405 <tag/Example/None.
3406 </descrip>
3407 </quote>
3408
3409
3410 <sect1>memset<label id="memset"><p>
3411
3412 <quote>
3413 <descrip>
3414 <tag/Function/Fill a memory area.
3415 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3416 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
3417 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
3418 the value <tt/val/. The function returns <tt/p/.
3419 <tag/Limits/
3420 <itemize>
3421 <item>The function is only available as fastcall function, so it may only
3422 be used in presence of a prototype.
3423 </itemize>
3424 <tag/Availability/ISO 9899
3425 <tag/See also/
3426 <ref id="_swap" name="_swap">,
3427 <ref id="bzero" name="bzero">,
3428 <ref id="memcpy" name="memcpy">,
3429 <ref id="memmove" name="memmove">
3430 <tag/Example/None.
3431 </descrip>
3432 </quote>
3433
3434
3435 <sect1>mod_free<label id="mod_free"><p>
3436
3437 <quote>
3438 <descrip>
3439 <tag/Function/Free a relocatable module.
3440 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3441 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
3442 <tag/Description/The function will free a module loaded into memory by use of
3443 the <tt/<ref id="mod_load" name="mod_load">/ function.
3444 <tag/Limits/<itemize>
3445 <item>The pointer passed as parameter is the pointer to the module memory,
3446 not the pointer to the control structure.
3447 </itemize>
3448 <tag/Availability/cc65
3449 <tag/See also/
3450 <ref id="mod_load" name="mod_load">
3451 <tag/Example/None.
3452 </descrip>
3453 </quote>
3454
3455
3456 <sect1>mod_load<label id="mod_load"><p>
3457
3458 <quote>
3459 <descrip>
3460 <tag/Function/Load a relocatable module.
3461 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3462 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
3463 <tag/Description/The function will load a code module into memory and relocate
3464 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
3465 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
3466 the module just loaded. Possible error codes are:
3467 <itemize>
3468 <item><tt/MLOAD_OK/ - Module load successful
3469 <item><tt/MLOAD_ERR_READ/ - Read error
3470 <item><tt/MLOAD_ERR_HDR/ - Header error
3471 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
3472 <item><tt/MLOAD_ERR_FMT/ - Data format error
3473 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
3474 </itemize>
3475 <tag/Limits/<itemize>
3476 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
3477 relocatable o65 modules for use with this function.
3478 </itemize>
3479 <tag/Availability/cc65
3480 <tag/See also/
3481 <ref id="mod_free" name="mod_free">
3482 <tag/Example/None.
3483 </descrip>
3484 </quote>
3485
3486
3487 <sect1>mouse_setbox<label id="mouse_setbox"><p>
3488
3489 <quote>
3490 <descrip>
3491 <tag/Function/Specify a bounding box for the mouse cursor.
3492 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3493 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
3494 <tag/Description/The function allows to set a bounding box for mouse movement.
3495 <tag/Limits/<itemize>
3496 <item>The function does not check if the mouse cursor is currently within the
3497 given rectangle. Placing the mouse cursor within the bounding box is the
3498 responsibility of the programmer.
3499 <item>While the bounding box may be larger than the actual screen size, the
3500 standard mouse cursor draw routines may fail to set the cursor to coordinates
3501 outside of the screen area. Depending on the platform, you may have to supply
3502 your own mouse cursor routines.
3503 <item>The function is only available as fastcall function, so it may only be
3504 used in presence of a prototype.
3505 </itemize>
3506 <tag/Availability/cc65
3507 <tag/See also/
3508 <ref id="mouse_getbox" name="mouse_getbox">,
3509 <ref id="mouse_move" name="mouse_move">
3510 <tag/Example/None.
3511 </descrip>
3512 </quote>
3513
3514
3515 <sect1>mouse_getbox<label id="mouse_getbox"><p>
3516
3517 <quote>
3518 <descrip>
3519 <tag/Function/Return the current bounding box for the mouse cursor.
3520 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3521 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
3522 <tag/Description/The function queries the current bounding box for mouse
3523 movement.
3524 <tag/Limits/<itemize>
3525 <item>The function is only available as fastcall function, so it may only be
3526 used in presence of a prototype.
3527 </itemize>
3528 <tag/Availability/cc65
3529 <tag/See also/
3530 <ref id="mouse_move" name="mouse_move">,
3531 <ref id="mouse_setbox" name="mouse_setbox">
3532 <tag/Example/None.
3533 </descrip>
3534 </quote>
3535
3536
3537 <sect1>mouse_buttons<label id="mouse_buttons"><p>
3538
3539 <quote>
3540 <descrip>
3541 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
3542 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3543 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_buttons (void);/
3544 <tag/Description/The function returns a bit mask that encodes the state of the
3545 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
3546 return value.
3547 <tag/Limits/<itemize>
3548 <item>The function is only available as fastcall function, so it may only be
3549 used in presence of a prototype.
3550 </itemize>
3551 <tag/Availability/cc65
3552 <tag/See also/
3553 <ref id="mouse_info" name="mouse_info">,
3554 <ref id="mouse_pos" name="mouse_pos">
3555 <tag/Example/None.
3556 </descrip>
3557 </quote>
3558
3559
3560 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
3561
3562 <quote>
3563 <descrip>
3564 <tag/Function/Return a readable error message for an error code.
3565 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3566 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
3567 code);/
3568 <tag/Description/The function returns an error message (in english) for the
3569 error code passed parameter.
3570 <tag/Limits/<itemize>
3571 <item>The function will return "Unknown error" for invalid error codes.
3572 <item>The function is only available as fastcall function, so it may only be
3573 used in presence of a prototype.
3574 </itemize>
3575 <tag/Availability/cc65
3576 <tag/See also/
3577 <ref id="mouse_load_driver" name="mouse_load_driver">,
3578 <ref id="mouse_uninstall" name="mouse_uninstall">,
3579 <ref id="mouse_unload" name="mouse_unload">
3580 <tag/Example/None.
3581 </descrip>
3582 </quote>
3583
3584
3585 <sect1>mouse_hide<label id="mouse_hide"><p>
3586
3587 <quote>
3588 <descrip>
3589 <tag/Function/Hide the mouse pointer.
3590 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3591 <tag/Declaration/<tt/void __fastcall__ mouse_hide (void);/
3592 <tag/Description/The function hides the mouse pointer. It manages a counter
3593 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
3594 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
3595 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
3596 visible.
3597 <tag/Limits/<itemize>
3598 <item>The function is only available as fastcall function, so it may only be
3599 used in presence of a prototype.
3600 </itemize>
3601 <tag/Availability/cc65
3602 <tag/See also/
3603 <ref id="mouse_show" name="mouse_show">
3604 <tag/Example/None.
3605 </descrip>
3606 </quote>
3607
3608
3609 <sect1>mouse_info<label id="mouse_info"><p>
3610
3611 <quote>
3612 <descrip>
3613 <tag/Function/Return the state of the mouse buttons and the position of the
3614 mouse.
3615 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3616 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
3617 <tag/Description/The function returns the state of the mouse buttons and the
3618 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
3619 <tag/Limits/<itemize>
3620 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
3621 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
3622 name="mouse_pos">/ instead.
3623 <item>The function is only available as fastcall function, so it may only be
3624 used in presence of a prototype.
3625 </itemize>
3626 <tag/Availability/cc65
3627 <tag/See also/
3628 <ref id="mouse_buttons" name="mouse_buttons">,
3629 <ref id="mouse_pos" name="mouse_pos">
3630 <tag/Example/None.
3631 </descrip>
3632 </quote>
3633
3634
3635 <sect1>mouse_install<label id="mouse_install"><p>
3636
3637 <quote>
3638 <descrip>
3639 <tag/Function/Install an already loaded mouse driver.
3640 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3641 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
3642 mouse_callbacks* c, void* driver);/
3643 <tag/Description/The function installs an already loaded mouse driver and
3644 returns an error code. The <tt/mouse_callbacks/ structure passed as first
3645 parameter contains pointers to routines needed to move or hide/show the mouse
3646 pointer. Defaults for these routines are supplied by the library, so if you
3647 can live with these defaults (which are platform specific), just pass a
3648 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
3649 driver linked statically to the program.
3650 <tag/Limits/<itemize>
3651 <item>Not all drivers are able to detect if the supported hardware is really
3652 present.
3653 <item>After installing a driver, the mouse cursor is hidden.
3654 <item>The function is only available as fastcall function, so it may only be
3655 used in presence of a prototype.
3656 </itemize>
3657 <tag/Availability/cc65
3658 <tag/See also/
3659 <ref id="mouse_load_driver" name="mouse_load_driver">,
3660 <ref id="mouse_uninstall" name="mouse_uninstall">,
3661 <ref id="mouse_unload" name="mouse_unload">
3662 <tag/Example/None.
3663 </descrip>
3664 </quote>
3665
3666
3667 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
3668
3669 <quote>
3670 <descrip>
3671 <tag/Function/Call the driver specific ioctl function.
3672 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3673 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
3674 <tag/Description/The function calls the IOCTL entry in the mouse driver,
3675 which is driver specific. The <tt/code/ parameter will choose between
3676 different IOCTL functions, and the <tt/data/ depends on code. The
3677 function returns an error code. The purpose of this function is to allow
3678 for driver specific extensions. See the documentation for a specific mouse
3679 driver for supported ioctl calls.
3680 <tag/Limits/<itemize>
3681 <item>Calling this function is non portable, because each driver may
3682 implement different ioctl calls (or none at all).
3683 <item>The function is only available as fastcall function, so it may only be
3684 used in presence of a prototype.
3685 </itemize>
3686 <tag/Availability/cc65
3687 <tag/Example/None.
3688 </descrip>
3689 </quote>
3690
3691
3692 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
3693
3694 <quote>
3695 <descrip>
3696 <tag/Function/Load and initialize a mouse driver.
3697 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3698 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
3699 mouse_callbacks* c, const char* driver);/
3700 <tag/Description/Load a mouse driver into memory and initialize it. The
3701 function returns an error code that tells if the call has been successful. The
3702 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
3703 routines needed to move or hide/show the mouse pointer. Defaults for these
3704 routines are supplied by the library, so if you can live with these defaults
3705 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
3706 <tag/Limits/<itemize>
3707 <item>The driver is loaded by name, so currently you must know the type of
3708 mouse that should be supported. There is no autodetect capability.
3709 <item>Not all drivers are able to detect if the supported hardware is really
3710 present.
3711 <item>After installing a driver, the mouse cursor is hidden.
3712 <item>The function is only available as fastcall function, so it may only be
3713 used in presence of a prototype.
3714 </itemize>
3715 <tag/Availability/cc65
3716 <tag/See also/
3717 <ref id="mouse_install" name="mouse_install">,
3718 <ref id="mouse_uninstall" name="mouse_uninstall">,
3719 <ref id="mouse_unload" name="mouse_unload">
3720 <tag/Example/None.
3721 </descrip>
3722 </quote>
3723
3724
3725 <sect1>mouse_move<label id="mouse_move"><p>
3726
3727 <quote>
3728 <descrip>
3729 <tag/Function/Move the mouse cursor to a specific position.
3730 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3731 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
3732 <tag/Description/The function updates the mouse position. If the mouse cursor
3733 is visible, it is shown at the new position.
3734 <tag/Limits/<itemize>
3735 <item>The function does not check if the new position is within the bounding
3736 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
3737 <item>The function is only available as fastcall function, so it may only be
3738 used in presence of a prototype.
3739 </itemize>
3740 <tag/Availability/cc65
3741 <tag/See also/
3742 <ref id="mouse_getbox" name="mouse_getbox">,
3743 <ref id="mouse_setbox" name="mouse_setbox">
3744 <tag/Example/None.
3745 </descrip>
3746 </quote>
3747
3748
3749 <sect1>mouse_pos<label id="mouse_pos"><p>
3750
3751 <quote>
3752 <descrip>
3753 <tag/Function/Return the position of the mouse.
3754 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3755 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
3756 <tag/Description/The function returns the position of the mouse in the
3757 <tt/mouse_pos/ structure passed as parameter.
3758 <tag/Limits/<itemize>
3759 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
3760 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
3761 name="mouse_info">/ instead.
3762 <item>The function is only available as fastcall function, so it may only be
3763 used in presence of a prototype.
3764 </itemize>
3765 <tag/Availability/cc65
3766 <tag/See also/
3767 <ref id="mouse_buttons" name="mouse_buttons">,
3768 <ref id="mouse_info" name="mouse_info">
3769 <tag/Example/None.
3770 </descrip>
3771 </quote>
3772
3773
3774 <sect1>mouse_show<label id="mouse_show"><p>
3775
3776 <quote>
3777 <descrip>
3778 <tag/Function/Show the mouse pointer.
3779 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3780 <tag/Declaration/<tt/void __fastcall__ mouse_show (void);/
3781 <tag/Description/The function shows the mouse pointer. It manages a counter
3782 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
3783 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
3784 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
3785 <tag/Limits/<itemize>
3786 <item>The function is only available as fastcall function, so it may only be
3787 used in presence of a prototype.
3788 </itemize>
3789 <tag/Availability/cc65
3790 <tag/See also/
3791 <ref id="mouse_hide" name="mouse_hide">
3792 <tag/Example/None.
3793 </descrip>
3794 </quote>
3795
3796
3797 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
3798
3799 <quote>
3800 <descrip>
3801 <tag/Function/Uninstall an already loaded mouse driver.
3802 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3803 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (void);/
3804 <tag/Description/The function uninstalls an already loaded mouse driver but
3805 don't removes it from memory.
3806 <tag/Limits/<itemize>
3807 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
3808 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
3809 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
3810 from memory.
3811 <item>The function is only available as fastcall function, so it may only be
3812 used in presence of a prototype.
3813 </itemize>
3814 <tag/Availability/cc65
3815 <tag/See also/
3816 <ref id="mouse_install" name="mouse_install">,
3817 <ref id="mouse_load_driver" name="mouse_load_driver">,
3818 <ref id="mouse_unload" name="mouse_unload">
3819 <tag/Example/None.
3820 </descrip>
3821 </quote>
3822
3823
3824 <sect1>mouse_unload<label id="mouse_unload"><p>
3825
3826 <quote>
3827 <descrip>
3828 <tag/Function/Unload a mouse driver.
3829 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3830 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
3831 <tag/Description/The function unloads a loaded mouse driver and frees all
3832 memory allocated for the driver.
3833 <tag/Limits/<itemize>
3834 <item>The function does nothing if no driver is loaded.
3835 </itemize>
3836 <tag/Availability/cc65
3837 <tag/See also/
3838 <ref id="mouse_install" name="mouse_install">,
3839 <ref id="mouse_load_driver" name="mouse_load_driver">,
3840 <ref id="mouse_uninstall" name="mouse_uninstall">
3841 <tag/Example/None.
3842 </descrip>
3843 </quote>
3844
3845
3846 <sect1>offsetof<label id="offsetof"><p>
3847
3848 <quote>
3849 <descrip>
3850 <tag/Function/Calculate the offset of a struct or union member.
3851 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
3852 <tag/Declaration/<tt/size_t offsetof (type, member);/
3853 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
3854 or <tt/union/ member.
3855 <tag/Limits/<itemize>
3856 <item>The function is actually a macro.
3857 </itemize>
3858 <tag/Availability/ISO 9899
3859 <tag/Example/None.
3860 </descrip>
3861 </quote>
3862
3863
3864 <sect1>open<label id="open"><p>
3865
3866 <quote>
3867 <descrip>
3868 <tag/Function/Open and possibly create a file.
3869 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
3870 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
3871 <tag/Description/<tt/open/ opens a file and returns the file descriptor
3872 associated with it. On error, -1 is returned and an error code is stored in
3873 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
3874 <tag/Limits/<itemize>
3875 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
3876 open, which is used as the permission mask when a new file is created. While
3877 cc65 allows to pass this argument, it is ignored.
3878 </itemize>
3879 <tag/Availability/POSIX 1003.1
3880 <tag/See also/
3881 <ref id="close" name="close">,
3882 <ref id="creat" name="creat">
3883 <tag/Example/None.
3884 </descrip>
3885 </quote>
3886
3887
3888 <sect1>peekbsys<label id="peekbsys"><p>
3889
3890 <quote>
3891 <descrip>
3892 <tag/Function/Read one byte from a location in the system bank.
3893 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3894 <tt/<ref id="cbm510.h" name="cbm510.h">/
3895 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
3896 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
3897 system bank (bank 15) of the CBM PET-II machines and returns it.
3898 <tag/Limits/
3899 <itemize>
3900 <item>The function is only available as fastcall function, so it may only
3901 be used in presence of a prototype.
3902 <item>This function may be a macro depending on the compiler options. The
3903 actual function is accessible by #undef'ing the macro.
3904 </itemize>
3905 <tag/Availability/cc65
3906 <tag/See also/
3907 <ref id="PEEK" name="PEEK">,
3908 <ref id="PEEKW" name="PEEKW">,
3909 <ref id="peekwsys" name="peekwsys">,
3910 <ref id="pokebsys" name="pokebsys">,
3911 <ref id="pokewsys" name="pokewsys">
3912 <tag/Example/None.
3913 </descrip>
3914 </quote>
3915
3916
3917 <sect1>peekwsys<label id="peekwsys"><p>
3918
3919 <quote>
3920 <descrip>
3921 <tag/Function/Read one word from a location in the system bank.
3922 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3923 <tt/<ref id="cbm510.h" name="cbm510.h">/
3924 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
3925 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
3926 system bank (bank 15) of the CBM PET-II machines and returns it. Following
3927 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
3928 high byte is read from <tt/addr+1/.
3929 <tag/Limits/
3930 <itemize>
3931 <item>The function is only available as fastcall function, so it may only
3932 be used in presence of a prototype.
3933 <item>The order in which the two bytes are read is undefined.
3934 </itemize>
3935 <tag/Availability/cc65
3936 <tag/See also/
3937 <ref id="PEEK" name="PEEK">,
3938 <ref id="PEEKW" name="PEEKW">,
3939 <ref id="peekbsys" name="peekbsys">,
3940 <ref id="pokebsys" name="pokebsys">,
3941 <ref id="pokewsys" name="pokewsys">
3942 <tag/Example/None.
3943 </descrip>
3944 </quote>
3945
3946
3947 <sect1>perror<label id="perror"><p>
3948
3949 <quote>
3950 <descrip>
3951 <tag/Function/Print an error message for the error in <tt/errno/.
3952 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3953 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
3954 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
3955 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
3956 a blank. Then the error message for the current contents of <tt/errno/ is
3957 printed followed by a newline. The message output is the same as returned by
3958 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
3959 <tag/Limits/
3960 <itemize>
3961 <item>The function is only available as fastcall function, so it may only
3962 be used in presence of a prototype.
3963 </itemize>
3964 <tag/Availability/ISO 9899
3965 <tag/See also/
3966 <ref id="_poserror" name="_poserror">,
3967 <ref id="strerror" name="strerror">
3968 <tag/Example/None.
3969 </descrip>
3970 </quote>
3971
3972
3973 <sect1>pokebsys<label id="pokebsys"><p>
3974
3975 <quote>
3976 <descrip>
3977 <tag/Function/Write one byte to a location in the system bank.
3978 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3979 <tt/<ref id="cbm510.h" name="cbm510.h">/
3980 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
3981 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
3982 system bank (bank 15) of the CBM PET-II machines.
3983 <tag/Limits/
3984 <itemize>
3985 <item>The function is only available as fastcall function, so it may only
3986 be used in presence of a prototype.
3987 </itemize>
3988 <tag/Availability/cc65
3989 <tag/See also/
3990 <ref id="POKE" name="POKE">,
3991 <ref id="POKEW" name="POKEW">,
3992 <ref id="peekbsys" name="peekbsys">,
3993 <ref id="peekwsys" name="peekwsys">,
3994 <ref id="pokewsys" name="pokewsys">
3995 <tag/Example/None.
3996 </descrip>
3997 </quote>
3998
3999
4000 <sect1>pokewsys<label id="pokewsys"><p>
4001
4002 <quote>
4003 <descrip>
4004 <tag/Function/Write one word to a location in the system bank.
4005 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4006 <tt/<ref id="cbm510.h" name="cbm510.h">/
4007 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
4008 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
4009 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
4010 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
4011 high byte is written to <tt/addr+1/.
4012 <tag/Limits/
4013 <itemize>
4014 <item>The function is only available as fastcall function, so it may only
4015 be used in presence of a prototype.
4016 <item>The order in which the two bytes are written is undefined.
4017 </itemize>
4018 <tag/Availability/cc65
4019 <tag/See also/
4020 <ref id="POKE" name="POKE">,
4021 <ref id="POKEW" name="POKEW">,
4022 <ref id="peekbsys" name="peekbsys">,
4023 <ref id="peekwsys" name="peekwsys">,
4024 <ref id="pokebsys" name="pokebsys">
4025 <tag/Example/None.
4026 </descrip>
4027 </quote>
4028
4029
4030 <sect1>qsort<label id="qsort"><p>
4031
4032 <quote>
4033 <descrip>
4034 <tag/Function/Sort an array.
4035 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4036 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
4037 size_t size, int (*compare) (const void*, const void*));/
4038 <tag/Description/<tt/qsort/ sorts an array according to a given compare
4039 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
4040 is the number of elements, <tt/size/ the size of an element and <tt/compare/
4041 the function used to compare the members.
4042 <tag/Limits/
4043 <itemize>
4044 <item>If there are multiple members with the same key, the order after calling
4045 the function is undefined.
4046 <item>The function is only available as fastcall function, so it may only
4047 be used in presence of a prototype.
4048 </itemize>
4049 <tag/Availability/ISO 9899
4050 <tag/See also/
4051 <ref id="bsearch" name="bsearch">
4052 <tag/Example/None.
4053 </descrip>
4054 </quote>
4055
4056
4057 <sect1>raise<label id="raise"><p>
4058
4059 <quote>
4060 <descrip>
4061 <tag/Function/Send a signal to the executing program.
4062 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4063 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
4064 <tag/Description/<tt/raise/ sends the given signal to the program. If the
4065 program has installed a signal handler for the signal, this signal handler
4066 will be executed. If no handler has been installed, the default action for
4067 the raised signal will be taken. The function returns zero on success,
4068 nonzero otherwise.
4069 <tag/Limits/<itemize>
4070 <item>The function is only available as fastcall function, so it may only
4071 be used in presence of a prototype.
4072 </itemize>
4073 <tag/Availability/ISO 9899
4074 <tag/See also/
4075 <ref id="abort" name="abort">,
4076 <ref id="signal" name="signal">
4077 <tag/Example/None.
4078 </descrip>
4079 </quote>
4080
4081
4082 <sect1>rand<label id="rand"><p>
4083
4084 <quote>
4085 <descrip>
4086 <tag/Function/Return a pseudo random number.
4087 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4088 <tag/Declaration/<tt/int rand (void);/
4089 <tag/Description/The function returns a pseudo random number
4090 between 0 and <tt/RAND_MAX/ (exclusive).
4091 <tag/Limits/<itemize>
4092 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
4093 flow of numbers is generated.
4094 <item>On startup, the function behaves as if <ref id="srand" name="srand">
4095 had been used with an argument of 1.
4096 </itemize>
4097 <tag/Availability/ISO 9899
4098 <tag/See also/
4099 <ref id="_randomize" name="_randomize">,
4100 <ref id="srand" name="srand">
4101 <tag/Example/None.
4102 </descrip>
4103 </quote>
4104
4105
4106 <sect1>realloc<label id="realloc"><p>
4107
4108 <quote>
4109 <descrip>
4110 <tag/Function/Change the size of an allocated memory block.
4111 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4112 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
4113 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
4114 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
4115 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
4116 behaves as if <tt/free/ had been called. On error (not enough memory
4117 available), <tt/realloc/ returns <tt/NULL/.
4118 <tag/Limits/
4119 <itemize>
4120 <item>The part of the memory block that is returned will have its contents
4121 unchanged.
4122 <item>This function is somewhat dangerous to use. Be careful to save the
4123 pointer you're passing somewhere else, otherwise
4124 <tscreen><verb>
4125         ptr = realloc (ptr, size);
4126 </verb></tscreen>
4127 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
4128 <item>The function is only available as fastcall function, so it may only
4129 be used in presence of a prototype.
4130 </itemize>
4131 <tag/Availability/ISO 9899
4132 <tag/See also/
4133 <ref id="_heapadd" name="_heapadd">,
4134 <ref id="_heapblocksize" name="_heapblocksize">,
4135 <ref id="_heapmaxavail" name="_heapmaxavail">,
4136 <ref id="_heapmemavail" name="_heapmemavail">,
4137 <ref id="calloc" name="calloc">,
4138 <ref id="free" name="free">,
4139 <ref id="realloc" name="realloc">
4140 <tag/Example/None.
4141 </descrip>
4142 </quote>
4143
4144
4145 <sect1>remove<label id="remove"><p>
4146
4147 <quote>
4148 <descrip>
4149 <tag/Function/Delete a file.
4150 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4151 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
4152 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
4153 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4154 code describing the reason for the failure.
4155 <tag/Limits/
4156 <itemize>
4157 <item>This function is not available on all cc65 targets (depends on the
4158 availability of file I/O).
4159 <item>The function is only available as fastcall function, so it may only
4160 be used in presence of a prototype.
4161 </itemize>
4162 <tag/Availability/ISO 9899
4163 <tag/See also/
4164 <ref id="rename" name="rename">,
4165 <ref id="unlink" name="unlink">
4166 <tag/Example/
4167 <verb>
4168 #include &lt;stdio.h&gt;
4169
4170 #define FILENAME "helloworld"
4171
4172 if (remove (FILENAME) == 0) {
4173     printf ("We deleted %s successfully\n", FILENAME);
4174 } else {
4175     printf ("There was a problem deleting %s\n", FILENAME);
4176 }
4177 </verb>
4178 </descrip>
4179 </quote>
4180
4181
4182 <sect1>rename<label id="rename"><p>
4183
4184 <quote>
4185 <descrip>
4186 <tag/Function/Rename a file.
4187 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4188 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
4189 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
4190 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4191 code describing the reason for the failure.
4192 <tag/Limits/
4193 <itemize>
4194 <item>This function is not available on all cc65 targets (depends on the
4195 capabilities of the storage devices).
4196 <item>The function is only available as fastcall function, so it may only
4197 be used in presence of a prototype.
4198 </itemize>
4199 <tag/Availability/ISO 9899
4200 <tag/See also/
4201 <ref id="remove" name="remove">
4202 <tag/Example/
4203 <verb>
4204 #include &lt;stdio.h&gt;
4205
4206 #define OLDNAME "textfile.txt"
4207 #define NEWNAME "textfile.bak"
4208
4209 if (rename (OLDNAME, NEWNAME) == 0) {
4210     printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
4211 } else {
4212     printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
4213 }
4214 </verb>
4215 </descrip>
4216 </quote>
4217
4218
4219 <sect1>reset_brk<label id="reset_brk"><p>
4220
4221 <quote>
4222 <descrip>
4223 <tag/Function/Resets the break vector to its original value.
4224 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4225 <tag/Declaration/<tt/void reset_brk (void);/
4226 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
4227 before a call to <tt/set_brk/.
4228 <tag/Limits/
4229 <itemize>
4230 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
4231 it is not strictly necessary to call this function as part of the cleanup when
4232 the program ends.
4233 </itemize>
4234 <tag/Availability/cc65
4235 <tag/See also/
4236 <ref id="reset_irq" name="reset_irq">,
4237 <ref id="set_brk" name="set_brk">,
4238 <ref id="set_irq" name="set_irq">
4239 <tag/Example/None.
4240 </descrip>
4241 </quote>
4242
4243
4244 <sect1>reset_irq<label id="reset_irq"><p>
4245
4246 <quote>
4247 <descrip>
4248 <tag/Function/Resets the C level interrupt request vector.
4249 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4250 <tag/Declaration/<tt/void reset_irq (void);/
4251 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
4252 <tag/Limits/
4253 <itemize>
4254 <item>The original IRQ vector is restored on program termination even without
4255 calling this function.
4256 </itemize>
4257 <tag/Availability/cc65
4258 <tag/See also/
4259 <ref id="reset_brk" name="reset_brk">,
4260 <ref id="set_brk" name="set_brk">,
4261 <ref id="set_irq" name="set_irq">
4262 <tag/Example/None.
4263 </descrip>
4264 </quote>
4265
4266
4267 <sect1>revers<label id="revers"><p>
4268
4269 <quote>
4270 <descrip>
4271 <tag/Function/Control revers character display.
4272 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4273 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
4274 <tag/Description/If the argument is non zero, the function enables reverse
4275 character display. If the argument is zero, reverse character display is
4276 switched off. The old value of the setting is returned.
4277 <tag/Limits/<itemize>
4278 <item>The function may not be supported by the hardware, in which case
4279 the call is ignored.
4280 <item>The function is only available as fastcall function, so it may only
4281 be used in presence of a prototype.
4282 </itemize>
4283 <tag/Availability/cc65
4284 <tag/See also/
4285 <ref id="textcolor" name="textcolor">
4286 <tag/Example/None.
4287 </descrip>
4288 </quote>
4289
4290
4291 <sect1>screensize<label id="screensize"><p>
4292
4293 <quote>
4294 <descrip>
4295 <tag/Function/Return the dimensions of the text mode screen.
4296 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4297 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
4298 <tag/Description/The function returns the dimensions of the text mode screen.
4299 <tag/Limits/<itemize>
4300 <item>The function is only available as fastcall function, so it may only
4301 be used in presence of a prototype.
4302 </itemize>
4303 <tag/Availability/cc65
4304 <tag/See also/
4305 <ref id="gotox" name="gotox">,
4306 <ref id="gotoxy" name="gotoxy">,
4307 <ref id="gotoy" name="gotoy">,
4308 <ref id="wherex" name="wherex">,
4309 <ref id="wherey" name="wherey">
4310 <tag/Example/None.
4311 </descrip>
4312 </quote>
4313
4314
4315 <sect1>ser_close<label id="ser_close"><p>
4316
4317 <quote>
4318 <descrip>
4319 <tag/Function/Close the port and disable interrupts
4320 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4321 <tag/Declaration/<tt/unsigned char __fastcall__ ser_close (const struct ser_params* params);/
4322 <tag/Description/Open the port by setting the port parameters and enable interrupts.
4323 <tag/Limits/<itemize>
4324 <item>The function is only available as fastcall function, so it may only
4325 be used in presence of a prototype.
4326 </itemize>
4327 <tag/Availability/cc65
4328 <tag/See also/Other serial functions.
4329 <tag/Example/
4330 <verb>
4331 #include <serial.h>
4332
4333 extern char comlynx[];
4334
4335 static void initialize(){
4336   struct ser_params params = {
4337     SER_BAUD_9600,
4338     SER_BITS_8,
4339     SER_STOP_1,
4340     SER_PAR_MARK,
4341     SER_HS_NONE
4342   };
4343   ser_install(&amp;comlynx); // This will activate the ComLynx
4344   CLI();
4345   ser_open(&amp;params);
4346 }
4347 </verb>
4348 </descrip>
4349 </quote>
4350
4351
4352 <sect1>ser_get<label id="ser_get"><p>
4353
4354 <quote>
4355 <descrip>
4356 <tag/Function/Read a character from serial port.
4357 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4358 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
4359 <tag/Description/Get a character from the serial port. If no characters are
4360 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
4361 error.
4362 <tag/Limits/<itemize>
4363 <item>The function is only available as fastcall function, so it may only
4364 be used in presence of a prototype.
4365 </itemize>
4366 <tag/Availability/cc65
4367 <tag/See also/Other serial functions.
4368 <tag/Example/
4369 Wait for a character to be available from a serial port.
4370 <verb>
4371 char ch;
4372 while (ser_get(&amp;ch) == SER_ERR_NO_DATA)
4373   ;
4374 </verb>
4375 </descrip>
4376 </quote>
4377
4378
4379 <sect1>ser_install<label id="ser_install"><p>
4380
4381 <quote>
4382 <descrip>
4383 <tag/Function/Install an already loaded driver and return an error code.
4384 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4385 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
4386 <tag/Description/The function installs a driver that was already loaded into
4387 memory (or linked statically to the program). It returns an error code
4388 (<tt/SER_ERR_OK/ in case of success).
4389 <tag/Limits/<itemize>
4390 <item>The function is only available as fastcall function, so it may only be
4391 used in presence of a prototype.
4392 </itemize>
4393 <tag/Availability/cc65
4394 <tag/See also/
4395 <ref id="ser_load_driver" name="ser_load_driver">,
4396 <ref id="ser_uninstall" name="ser_uninstall">,
4397 <ref id="ser_unload" name="ser_unload">
4398 <tag/Example/<verb>
4399 extern char lynxser[]; //Include the driver statically instead of loading it.
4400
4401 ser_install(&amp;lynxser);
4402 </verb>
4403 </descrip>
4404 </quote>
4405
4406
4407 <sect1>ser_ioctl<label id="ser_ioctl"><p>
4408
4409 <quote>
4410 <descrip>
4411 <tag/Function/Platform dependent code extensions.
4412 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4413 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
4414 <tag/Description/Some platforms have extra serial functions that are not
4415 supported by standard serial driver functions. You can extend the driver to support
4416 this extra functionality bt using ser_ioctl functions.
4417 <tag/Limits/<itemize>
4418 <item>The function is only available as fastcall function, so it may only
4419 be used in presence of a prototype.
4420 <item>These functions are not easily portable to other cc65 platforms.
4421 </itemize>
4422 <tag/Availability/cc65
4423 <tag/See also/Other serial functions.
4424 <tag/Example/None
4425 </descrip>
4426 </quote>
4427
4428 <sect1>ser_load_driver<label id="ser_load_driver"><p>
4429
4430 <quote>
4431 <descrip>
4432 <tag/Function/Load and install a serial driver.
4433 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4434 <tag/Declaration/<tt/void __fastcall__ ser_load_driver (const char *name);/
4435 <tag/Description/Load and install the driver by name.
4436 Will just load the driver and check if loading was successful.
4437 <tag/Limits/<itemize>
4438 <item>The function is only available as fastcall function, so it may only
4439 be used in presence of a prototype.
4440 </itemize>
4441 <tag/Availability/cc65
4442 <tag/See also/Other serial functions.
4443 <tag/Example/None.
4444 </descrip>
4445 </quote>
4446
4447
4448 <sect1>ser_open<label id="ser_open"><p>
4449
4450 <quote>
4451 <descrip>
4452 <tag/Function/Open the port by setting the port parameters and enable interrupts
4453 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4454 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
4455 <tag/Description/Open the port by setting the port parameters and enable interrupts.
4456 <tag/Limits/<itemize>
4457 <item>The function is only available as fastcall function, so it may only
4458 be used in presence of a prototype.
4459 </itemize>
4460 <tag/Availability/cc65
4461 <tag/See also/Other serial functions.
4462 <tag/Example/
4463 <verb>
4464 #include <serial.h>
4465
4466 extern char comlynx[];
4467
4468 static void initialize(){
4469   struct ser_params params = {
4470     SER_BAUD_9600,
4471     SER_BITS_8,
4472     SER_STOP_1,
4473     SER_PAR_MARK,
4474     SER_HS_NONE
4475   };
4476   ser_install(&amp;comlynx); // This will activate the ComLynx
4477   CLI();
4478   ser_open(&amp;params);
4479 }
4480 </verb>
4481 </descrip>
4482 </quote>
4483
4484
4485 <sect1>ser_put<label id="ser_put"><p>
4486
4487 <quote>
4488 <descrip>
4489 <tag/Function/Write a character to a serial port.
4490 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4491 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
4492 <tag/Description/Send a character via the serial port. There is a transmit
4493 buffer, but transmitting is not done via interrupt. The function returns
4494 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
4495 <tag/Limits/<itemize>
4496 <item>The function is only available as fastcall function, so it may only
4497 be used in presence of a prototype.
4498 </itemize>
4499 <tag/Availability/cc65
4500 <tag/See also/Other serial functions.
4501 <tag/Example/
4502 <verb>
4503 ser_put('A');
4504 </verb>
4505 </descrip>
4506 </quote>
4507
4508
4509 <sect1>ser_status<label id="ser_status"><p>
4510
4511 <quote>
4512 <descrip>
4513 <tag/Function/Return the serial port status.
4514 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4515 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (unsigned char* status);/
4516 <tag/Description/Return the serial port status.
4517 <tag/Limits/<itemize>
4518 <item>The function is only available as fastcall function, so it may only
4519 be used in presence of a prototype.
4520 </itemize>
4521 <tag/Availability/cc65
4522 <tag/See also/Other serial functions.
4523 <tag/Example/None
4524 </descrip>
4525 </quote>
4526
4527
4528 <sect1>ser_uninstall<label id="ser_uninstall"><p>
4529
4530 <quote>
4531 <descrip>
4532 <tag/Function/Uninstall the currently loaded driver but do not unload it.
4533 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4534 <tag/Declaration/<tt/void __fastcall__ ser_uninstall (void);/
4535 <tag/Description/Uninstall the currently loaded driver but do not unload it.
4536 <tag/Limits/<itemize>
4537 <item>The function is only available as fastcall function, so it may only
4538 be used in presence of a prototype.
4539 </itemize>
4540 <tag/Availability/cc65
4541 <tag/See also/Other serial functions.
4542 <tag/Example/None.
4543 </descrip>
4544 </quote>
4545
4546 <sect1>ser_unload<label id="ser_unload"><p>
4547
4548 <quote>
4549 <descrip>
4550 <tag/Function/Uninstall, then unload the currently loaded driver.
4551 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
4552 <tag/Declaration/<tt/void __fastcall__ ser_unload (void);/
4553 <tag/Description/Uninstall, then unload the currently loaded driver.
4554 <tag/Limits/<itemize>
4555 <item>The function is only available as fastcall function, so it may only
4556 be used in presence of a prototype.
4557 </itemize>
4558 <tag/Availability/cc65
4559 <tag/See also/Other serial functions.
4560 <tag/Example/None.
4561 </descrip>
4562 </quote>
4563
4564
4565 <sect1>set_brk<label id="set_brk"><p>
4566
4567 <quote>
4568 <descrip>
4569 <tag/Function/Set the break vector to a user function.
4570 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4571 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
4572 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
4573 program code by letting the vector point to a user written C function. The
4574 runtime library installs a small stub that saves the registers into global
4575 variables that may be accessed (and changed) by the break handler.
4576 <tag/Limits/
4577 <itemize>
4578 <item>The function is only available as fastcall function, so it may only
4579 be used in presence of a prototype.
4580 <item>The stub saves the zero page registers used by the C runtime and switches
4581 to a small break handler stack. This means that it is safe to execute C code,
4582 even if C code was interrupted. Be careful however not to use too many local
4583 variables, and do not enable stack checks for the handler function or any other
4584 function called from it.
4585 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
4586 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
4587 otherwise the <tt/BRK/ instruction will get executed over and over again.
4588 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
4589 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
4590 the program terminates.
4591 </itemize>
4592 <tag/Availability/cc65
4593 <tag/See also/
4594 <ref id="reset_brk" name="reset_brk">
4595 <tag/Example/None.
4596 </descrip>
4597 </quote>
4598
4599
4600 <sect1>set_irq<label id="set_irq"><p>
4601
4602 <quote>
4603 <descrip>
4604 <tag/Function/Set the C level interrupt request vector to the given address.
4605 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4606 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
4607 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
4608 (IRQs) within the program code by letting the vector point to a user written C
4609 function. The runtime library installs a small stub that saves the zero page
4610 registers used by the C runtime before calling the handler function and restores
4611 them after the handler function returns. Additionally the stub temporarily switches
4612 the C runtime stack to the stack area provided as parameter. If the handler function
4613 was set up to handle a "private", "exclusive" interrupt request source it must
4614 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
4615 interrupt request actually stems from that source. In all other cases it must return
4616 the value <tt/IRQ_NOT_HANDLED/.
4617 <tag/Limits/
4618 <itemize>
4619 <item>The function is only available as fastcall function, so it may only
4620 be used in presence of a prototype.
4621 <item>The stub saves the registers and zero page locations used by the C runtime
4622 and switches to the provided stack area. As a consequence, there is some
4623 runtime overhead, but it it is safe to execute C code, even if other C code
4624 was interrupted. Be careful however not to call C library functions, and do not
4625 enable stack checks for the handler function or any other function called from
4626 it.
4627 <item>The interrupt vector is reset on function termination, so it's not
4628 strictly necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as part
4629 of the cleanup when the program terminates.
4630 </itemize>
4631 <tag/Availability/cc65
4632 <tag/See also/
4633 <ref id="reset_brk" name="reset_brk">,
4634 <ref id="reset_irq" name="reset_irq">,
4635 <ref id="set_brk" name="set_brk">
4636 <tag/Example/None.
4637 </descrip>
4638 </quote>
4639
4640
4641 <sect1>setjmp<label id="setjmp"><p>
4642
4643 <quote>
4644 <descrip>
4645 <tag/Function/Save the context for use with <tt/longjmp/.
4646 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4647 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
4648 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
4649 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
4650 returns zero.
4651 <tag/Limits/
4652 <itemize>
4653 <item>The function is only available as fastcall function, so it may only
4654 be used in presence of a prototype.
4655 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
4656 <item><tt/setjmp/ will not save the signal context.
4657 </itemize>
4658 <tag/Availability/ISO 9899
4659 <tag/See also/
4660 <ref id="longjmp" name="longjmp">
4661 <tag/Example/None.
4662 </descrip>
4663 </quote>
4664
4665
4666 <sect1>setlocale<label id="setlocale"><p>
4667
4668 <quote>
4669 <descrip>
4670 <tag/Function/Selects a locale.
4671 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4672 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
4673 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
4674 <tag/Limits/
4675 <itemize>
4676 <item>The function is only available as fastcall function, so it may only
4677 be used in presence of a prototype.
4678 <item>cc65 supports only the "C" locale, so calling this function to set a
4679 different locale has no effect.
4680 </itemize>
4681 <tag/Availability/ISO 9899
4682 <tag/See also/
4683 <ref id="localeconv" name="localeconv">,
4684 <ref id="strcoll" name="strcoll">
4685 <ref id="strxfrm" name="strxfrm">
4686 <tag/Example/None.
4687 </descrip>
4688 </quote>
4689
4690
4691 <sect1>signal<label id="signal"><p>
4692
4693 <quote>
4694 <descrip>
4695 <tag/Function/Install a signal handler.
4696 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4697 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
4698 <tag/Description/<tt/signal/ installs a handler for the given signal. The
4699 handler may either be a user supplied function, or one of the predefined
4700 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
4701 previous value if the signal , or the special function vector SIG_ERR in
4702 case of an error.
4703 <tag/Limits/<itemize>
4704 <item>The function is only available as fastcall function, so it may only
4705 be used in presence of a prototype.
4706 </itemize>
4707 <tag/Availability/ISO 9899
4708 <tag/See also/
4709 <ref id="abort" name="abort">,
4710 <ref id="raise" name="raise">
4711 <tag/Example/None.
4712 </descrip>
4713 </quote>
4714
4715
4716 <sect1>sleep<label id="sleep"><p>
4717
4718 <quote>
4719 <descrip>
4720 <tag/Function/Sleep for a specified amount of time.
4721 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4722 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
4723 <tag/Description/The function will return after the specified number of
4724 seconds have elapsed.
4725 <tag/Limits/<itemize>
4726 <item>The function is only available as fastcall function, so it may only
4727 be used in presence of a prototype.
4728 </itemize>
4729 <tag/Availability/POSIX 1003.1
4730 <tag/Example/None.
4731 </descrip>
4732 </quote>
4733
4734
4735 <sect1>slow<label id="slow"><p>
4736
4737 <quote>
4738 <descrip>
4739 <tag/Function/Switch the C128 into 1MHz mode.
4740 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4741 <tag/Declaration/<tt/void slow (void);/
4742 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
4743 will halve the speed compared to fast mode.
4744 <tag/Limits/<itemize>
4745 <item>The function is specific to the C128.
4746 </itemize>
4747 <tag/Availability/C128
4748 <tag/See also/
4749 <ref id="fast" name="fast">,
4750 <ref id="toggle_videomode" name="toggle_videomode">,
4751 <ref id="videomode" name="videomode">
4752 <tag/Example/None.
4753 </descrip>
4754 </quote>
4755
4756
4757 <sect1>srand<label id="srand"><p>
4758
4759 <quote>
4760 <descrip>
4761 <tag/Function/Initialize the pseudo random number generator.
4762 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4763 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
4764 <tag/Description/The function initializes the random number generator using
4765 the given seed. On program startup, the generator behaves as if <tt/srand/ has
4766 been called with an argument of 1.
4767 <tag/Limits/<itemize>
4768 <item>The function is only available as fastcall function, so it may only
4769 be used in presence of a prototype.
4770 </itemize>
4771 <tag/Availability/ISO 9899
4772 <tag/See also/
4773 <ref id="_randomize" name="_randomize">,
4774 <ref id="rand" name="rand">
4775 <tag/Example/None.
4776 </descrip>
4777 </quote>
4778
4779
4780 <sect1>strcasecmp<label id="strcasecmp"><p>
4781
4782 <quote>
4783 <descrip>
4784 <tag/Function/Compare two strings case insensitive.
4785 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4786 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
4787 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
4788 as parameters without case sensitivity. It returns a value that is less than
4789 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
4790 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
4791 <tag/Limits/<itemize>
4792 <item>The function is only available as fastcall function, so it may only
4793 be used in presence of a prototype.
4794 <item>The function is not available in strict ANSI mode.
4795 </itemize>
4796 <tag/Availability/cc65
4797 <tag/See also/
4798 <ref id="strcmp" name="strcmp">,
4799 <ref id="strcoll" name="strcoll">,
4800 <ref id="stricmp" name="stricmp">,
4801 <ref id="strncmp" name="strncmp">,
4802 <ref id="strxfrm" name="strxfrm">
4803 <tag/Example/None.
4804 </descrip>
4805 </quote>
4806
4807
4808 <sect1>strcat<label id="strcat"><p>
4809
4810 <quote>
4811 <descrip>
4812 <tag/Function/Concatentate two strings.
4813 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4814 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
4815 <tag/Description/The <tt/strcat/ function appends a copy of the string
4816 pointed to by s2 (including the terminating null byte) to the end of the
4817 string pointed to by s1. The initial byte of s2 overwrites the null byte at
4818 the end of s1.
4819 <tag/Limits/<itemize>
4820 <item>The function is only available as fastcall function, so it may only
4821 be used in presence of a prototype.
4822 <item>If copying takes place between objects that overlap, the behaviour
4823 is undefined.
4824 </itemize>
4825 <tag/Availability/ISO 9899
4826 <tag/See also/
4827 <ref id="strcpy" name="strcpy">,
4828 <ref id="strncat" name="strncat">,
4829 <ref id="strncpy" name="strncpy">
4830 <tag/Example/None.
4831 </descrip>
4832 </quote>
4833
4834
4835 <sect1>strchr<label id="strchr"><p>
4836
4837 <quote>
4838 <descrip>
4839 <tag/Function/Search for a character in a string.
4840 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4841 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
4842 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
4843 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4844 byte is considered to be part of the string. Upon completion, the function
4845 returns a pointer to the byte, or a null pointer if the byte was not found.
4846 <tag/Limits/<itemize>
4847 <item>The function is only available as fastcall function, so it may only
4848 be used in presence of a prototype.
4849 </itemize>
4850 <tag/Availability/ISO 9899
4851 <tag/See also/
4852 <ref id="memchr" name="memchr">,
4853 <ref id="strrchr" name="strrchr">
4854 <tag/Example/None.
4855 </descrip>
4856 </quote>
4857
4858
4859 <sect1>strcmp<label id="strcmp"><p>
4860
4861 <quote>
4862 <descrip>
4863 <tag/Function/Compare two strings.
4864 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4865 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
4866 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
4867 parameters. It returns a value that is less than zero if <tt/s1/ is less than
4868 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
4869 if <tt/s1/ is greater than <tt/s2/.
4870 <tag/Limits/<itemize>
4871 <item>The function is only available as fastcall function, so it may only
4872 be used in presence of a prototype.
4873 </itemize>
4874 <tag/Availability/ISO 9899
4875 <tag/See also/
4876 <ref id="strcasecmp" name="strcasecmp">,
4877 <ref id="strcoll" name="strcoll">,
4878 <ref id="stricmp" name="stricmp">,
4879 <ref id="strncmp" name="strncmp">
4880 <ref id="strxfrm" name="strxfrm">
4881 <tag/Example/None.
4882 </descrip>
4883 </quote>
4884
4885
4886 <sect1>strcoll<label id="strcoll"><p>
4887
4888 <quote>
4889 <descrip>
4890 <tag/Function/Compare two strings.
4891 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4892 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
4893 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
4894 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
4895 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
4896 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
4897 than zero if <tt/s1/ is greater than <tt/s2/.
4898 <tag/Limits/<itemize>
4899 <item>The function is only available as fastcall function, so it may only
4900 be used in presence of a prototype.
4901 </itemize>
4902 <tag/Availability/ISO 9899
4903 <tag/See also/
4904 <ref id="setlocale" name="setlocale">,
4905 <ref id="strcasecmp" name="strcasecmp">,
4906 <ref id="strcmp" name="strcmp">,
4907 <ref id="stricmp" name="stricmp">,
4908 <ref id="strncmp" name="strncmp">,
4909 <ref id="strxfrm" name="strxfrm">
4910 <tag/Example/None.
4911 </descrip>
4912 </quote>
4913
4914
4915 <sect1>strcpy<label id="strcpy"><p>
4916
4917 <quote>
4918 <descrip>
4919 <tag/Function/Copy a string.
4920 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4921 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
4922 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
4923 <tt/s2/ (including the terminating null byte) into the array pointed to by
4924 <tt/s1/. The function will always return <tt/s1/.
4925 <tag/Limits/<itemize>
4926 <item>The function is only available as fastcall function, so it may only
4927 be used in presence of a prototype.
4928 <item>If copying takes place between objects that overlap, the behaviour
4929 is undefined.
4930 </itemize>
4931 <tag/Availability/ISO 9899
4932 <tag/See also/
4933 <ref id="strcat" name="strcat">,
4934 <ref id="strncat" name="strncat">,
4935 <ref id="strncpy" name="strncpy">
4936 <tag/Example/
4937 <verb>
4938 #include &lt;string.h&gt;
4939
4940 static char hello[14];
4941
4942 strcpy (hello, "Hello world!\n");
4943 </verb>
4944 </descrip>
4945 </quote>
4946
4947
4948 <sect1>strcspn<label id="strcspn"><p>
4949
4950 <quote>
4951 <descrip>
4952 <tag/Function/Compute the length of a substring.
4953 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4954 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
4955 <tag/Description/The <tt/strcspn/ function computes and returns the length of
4956 the substring pointed to by <tt/s/ which does <em>not</em> consist of
4957 characters contained in the string <tt/set/.
4958 <tag/Limits/<itemize>
4959 <item>The function is only available as fastcall function, so it may only
4960 be used in presence of a prototype.
4961 </itemize>
4962 <tag/Availability/ISO 9899
4963 <tag/See also/
4964 <ref id="strspn" name="strspn">,
4965 <ref id="strstr" name="strstr">,
4966 <ref id="strtok" name="strtok">
4967 <tag/Example/None.
4968 </descrip>
4969 </quote>
4970
4971
4972 <sect1>strdup<label id="strdup"><p>
4973
4974 <quote>
4975 <descrip>
4976 <tag/Function/Allocate a copy of a string on the heap.
4977 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4978 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
4979 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
4980 to hold a copy of <tt/s/ including the terminating zero. If the allocation
4981 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
4982 memory block, and a pointer to the block is returned.
4983 <tag/Limits/<itemize>
4984 <item>The function is only available as fastcall function, so it may only
4985 be used in presence of a prototype.
4986 <item>It is up to the caller to free the allocated memory block.
4987 </itemize>
4988 <tag/Availability/ISO 9899
4989 <tag/See also/
4990 <ref id="free" name="free">,
4991 <ref id="malloc" name="malloc">
4992 <tag/Example/None.
4993 </descrip>
4994 </quote>
4995
4996
4997 <sect1>strerror<label id="strerror"><p>
4998
4999 <quote>
5000 <descrip>
5001 <tag/Function/Return a string describing an error code.
5002 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5003 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
5004 <tag/Description/The <tt/strerror/ function returns a string describing the
5005 given error code. If an invalid error code is passed, the string "Unknown
5006 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
5007 <tt/errno/ is left untouched.
5008 <tag/Limits/<itemize>
5009 <item>The function is only available as fastcall function, so it may only
5010 be used in presence of a prototype.
5011 <item>While the return type of the function is a <tt/char*/, the returned
5012 string must not be modified by the caller!
5013 </itemize>
5014 <tag/Availability/ISO 9899
5015 <tag/See also/
5016 <ref id="_stroserror" name="_stroserror">
5017 <tag/Example/None.
5018 </descrip>
5019 </quote>
5020
5021
5022 <sect1>stricmp<label id="stricmp"><p>
5023
5024 <quote>
5025 <descrip>
5026 <tag/Function/Compare two strings case insensitive.
5027 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5028 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
5029 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
5030 parameters without case sensitivity. It returns a value that is less than zero
5031 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
5032 value greater than zero if <tt/s1/ is greater than <tt/s2/.
5033 <tag/Limits/<itemize>
5034 <item>The function is only available as fastcall function, so it may only
5035 be used in presence of a prototype.
5036 <item>The function is not available in strict ANSI mode.
5037 </itemize>
5038 <tag/Availability/cc65
5039 <tag/See also/
5040 <ref id="strcasecmp" name="strcasecmp">,
5041 <ref id="strcmp" name="strcmp">,
5042 <ref id="strcoll" name="strcoll">,
5043 <ref id="strncmp" name="strncmp">,
5044 <ref id="strxfrm" name="strxfrm">
5045 <tag/Example/None.
5046 </descrip>
5047 </quote>
5048
5049
5050 <sect1>strlen<label id="strlen"><p>
5051
5052 <quote>
5053 <descrip>
5054 <tag/Function/Return the length of a string.
5055 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5056 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
5057 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
5058 string to which s points, not including the terminating null byte.
5059 <tag/Limits/<itemize>
5060 <item>The function is only available as fastcall function, so it may only
5061 be used in presence of a prototype.
5062 <item>When compiling with <tt/-Os/ (inline known standard functions), the
5063 function does not work correctly for strings with more than 255 characters.
5064 </itemize>
5065 <tag/Availability/ISO 9899
5066 <tag/See also/
5067 <ref id="strcpy" name="strcpy">
5068 <tag/Example/None.
5069 </descrip>
5070 </quote>
5071
5072
5073 <sect1>strlower<label id="strlower"><p>
5074
5075 <quote>
5076 <descrip>
5077 <tag/Function/Make a string lower case.
5078 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5079 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
5080 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
5081 function to each character of a string. The function will always return <tt/s/.
5082 <tag/Limits/<itemize>
5083 <item>The function is only available as fastcall function, so it may only
5084 be used in presence of a prototype.
5085 <item>The function prototype is unavailable when compiling in strict ANSI mode.
5086 <item>An alias name for this function is <tt/strlwr/.
5087 </itemize>
5088 <tag/Availability/cc65
5089 <tag/See also/
5090 <ref id="strupper" name="strupper">,
5091 <ref id="tolower" name="tolower">
5092 <tag/Example/None.
5093 </descrip>
5094 </quote>
5095
5096
5097 <sect1>strlwr<label id="strlwr"><p>
5098
5099 <quote>
5100 See <tt/strlower/.
5101 </quote>
5102
5103
5104 <sect1>strncat<label id="strncat"><p>
5105
5106 <quote>
5107 <descrip>
5108 <tag/Function/Concatentate two strings.
5109 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5110 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
5111 <tag/Description/The <tt/strncat/ function appends not more than n characters
5112 of the string pointed to by s2 to the end of the string pointed to by s1. The
5113 terminating null character at the end of s1 is overwritten. A terminating null
5114 character is appended to the result, even if not all of s2 is appended to s1.
5115 <tag/Limits/<itemize>
5116 <item>The function is only available as fastcall function, so it may only
5117 be used in presence of a prototype.
5118 <item>If copying takes place between objects that overlap, the behaviour
5119 is undefined.
5120 </itemize>
5121 <tag/Availability/ISO 9899
5122 <tag/See also/
5123 <ref id="strcpy" name="strcpy">,
5124 <ref id="strncat" name="strncat">,
5125 <ref id="strncpy" name="strncpy">
5126 <tag/Example/None.
5127 </descrip>
5128 </quote>
5129
5130
5131 <sect1>strncmp<label id="strncmp"><p>
5132
5133 <quote>
5134 <descrip>
5135 <tag/Function/Compare two strings.
5136 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5137 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
5138 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
5139 characters of the two strings passed as parameters. It returns a value that is
5140 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
5141 <tt/s2/, zero if they are identical, and a value greater than zero they are
5142 greater.
5143 <tag/Limits/<itemize>
5144 <item>The function is only available as fastcall function, so it may only
5145 be used in presence of a prototype.
5146 </itemize>
5147 <tag/Availability/ISO 9899
5148 <tag/See also/
5149 <ref id="strcasecmp" name="strcasecmp">,
5150 <ref id="strcmp" name="strcmp">,
5151 <ref id="strcoll" name="strcoll">,
5152 <ref id="stricmp" name="stricmp">,
5153 <ref id="strxfrm" name="strxfrm">
5154 <tag/Example/None.
5155 </descrip>
5156 </quote>
5157
5158
5159 <sect1>strncpy<label id="strncpy"><p>
5160
5161 <quote>
5162 <descrip>
5163 <tag/Function/Copy part of a string.
5164 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5165 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
5166 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
5167 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
5168 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
5169 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
5170 written. The function will always return <tt/s1/.
5171 <tag/Limits/<itemize>
5172 <item>The function is only available as fastcall function, so it may only
5173 be used in presence of a prototype. If there is no null byte in the first <tt/n/
5174 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
5175 <item>If copying takes place between objects that overlap, the behaviour is
5176 undefined.
5177 </itemize>
5178 <tag/Availability/ISO 9899
5179 <tag/See also/
5180 <ref id="strcat" name="strcat">,
5181 <ref id="strcpy" name="strcpy">,
5182 <ref id="strncat" name="strncat">
5183 <tag/Example/
5184 <verb>
5185 #include <string.h>
5186
5187 static char hello[6];
5188
5189 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
5190 hello[5] = '\0';
5191 </verb>
5192 </descrip>
5193 </quote>
5194
5195
5196 <sect1>strrchr<label id="strrchr"><p>
5197
5198 <quote>
5199 <descrip>
5200 <tag/Function/Search for a character in a string.
5201 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5202 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
5203 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
5204 (converted to a char) in the string pointed to by <tt/s/. The terminating null
5205 byte is considered to be part of the string. Upon completion, the function
5206 returns a pointer to the byte, or a null pointer if the byte was not found.
5207 <tag/Limits/<itemize>
5208 <item>The function is only available as fastcall function, so it may only
5209 be used in presence of a prototype.
5210 </itemize>
5211 <tag/Availability/ISO 9899
5212 <tag/See also/
5213 <ref id="strchr" name="strchr">
5214 <tag/Example/None.
5215 </descrip>
5216 </quote>
5217
5218
5219 <sect1>strspn<label id="strspn"><p>
5220
5221 <quote>
5222 <descrip>
5223 <tag/Function/Compute the length of a substring.
5224 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5225 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
5226 <tag/Description/The <tt/strspn/ function computes and returns the length of
5227 the substring pointed to by <tt/s/ which does consist only of characters
5228 contained in the string <tt/set/.
5229 <tag/Limits/<itemize>
5230 <item>The function is only available as fastcall function, so it may only
5231 be used in presence of a prototype.
5232 </itemize>
5233 <tag/Availability/ISO 9899
5234 <tag/See also/
5235 <ref id="strcspn" name="strcspn">,
5236 <ref id="strstr" name="strstr">
5237 <tag/Example/None.
5238 </descrip>
5239 </quote>
5240
5241
5242 <sect1>strstr<label id="strstr"><p>
5243
5244 <quote>
5245 <descrip>
5246 <tag/Function/Find a substring.
5247 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5248 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
5249 <tag/Description/<tt/strstr/ searches for the first occurance of the string
5250 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
5251 otherwise it returns <tt/NULL/.
5252 <tag/Limits/<itemize>
5253 <item>The function is only available as fastcall function, so it may only
5254 be used in presence of a prototype.
5255 </itemize>
5256 <tag/Availability/ISO 9899
5257 <tag/See also/
5258 <ref id="strcspn" name="strcspn">,
5259 <ref id="strspn" name="strspn">
5260 <tag/Example/None.
5261 </descrip>
5262 </quote>
5263
5264
5265 <sect1>strtok<label id="strtok"><p>
5266
5267 <quote>
5268 <descrip>
5269 <tag/Function/Break a string into tokens.
5270 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5271 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
5272 <tag/Description/<tt/strtok/ will break the string s1 into a sequence of
5273 tokens, which are delimited by characters from the string s2. The first call
5274 to <tt/strtok/ will return a pointer to the first token in the string s1.
5275 Following calls must pass a <tt/NULL/ pointer as s1 in order to get the next
5276 token in the string. Different sets of delimiters may be used for the
5277 subsequent calls to <tt/strtok/.
5278 <tag/Limits/<itemize>
5279 <item>The function is only available as fastcall function, so it may only
5280 be used in presence of a prototype.
5281 <item><tt/strtok/ will modify the string s1.
5282 </itemize>
5283 <tag/Availability/ISO 9899
5284 <tag/See also/
5285 <ref id="strcspn" name="strcspn">,
5286 <!-- <ref id="strpbrk" name="strpbrk"> -->
5287 <tag/Example/None.
5288 </descrip>
5289 </quote>
5290
5291
5292 <sect1>strxfrm<label id="strxfrm"><p>
5293
5294 <quote>
5295 <descrip>
5296 <tag/Function/Transform a string.
5297 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5298 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
5299 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
5300 s2 and places the resulting string into the string pointed to by s1. The
5301 transformation is such that if the <tt/strcmp/ function is applied to two
5302 transformed strings, it returns a value greater than, equal to, or less than
5303 zero, corresponding to the result of the <tt/strcoll/ function applied to the
5304 same two original strings. No more than n characters are placed into the
5305 resulting array pointed to by s1, including the terminating null character.
5306 <tag/Limits/<itemize>
5307 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
5308 the behaviour is undefined.
5309 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
5310 <item>The function is only available as fastcall function, so it may only
5311 be used in presence of a prototype.
5312 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
5313 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
5314 </itemize>
5315 <tag/Availability/ISO 9899
5316 <tag/See also/
5317 <ref id="strcmp" name="strcmp">,
5318 <ref id="strcoll" name="strcoll">,
5319 <ref id="strncpy" name="strncpy">
5320 <tag/Example/None.
5321 </descrip>
5322 </quote>
5323
5324
5325 <sect1>strupper<label id="strupper"><p>
5326
5327 <quote>
5328 <descrip>
5329 <tag/Function/Make a string upper case.
5330 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5331 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
5332 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
5333 function to each character of a string. The function will always return <tt/s/.
5334 <tag/Limits/<itemize>
5335 <item>The function is only available as fastcall function, so it may only
5336 be used in presence of a prototype.
5337 <item>The function prototype is unavailable when compiling in strict ANSI mode.
5338 <item>An alias name for this function is <tt/strupr/.
5339 </itemize>
5340 <tag/Availability/cc65
5341 <tag/See also/
5342 <ref id="strlower" name="strlower">
5343 <ref id="toupper" name="toupper">
5344 <tag/Example/None.
5345 </descrip>
5346 </quote>
5347
5348
5349 <sect1>strupr<label id="strupr"><p>
5350
5351 <quote>
5352 See <tt/strupper/.
5353 </quote>
5354
5355
5356 <sect1>textcolor<label id="textcolor"><p>
5357
5358 <quote>
5359 <descrip>
5360 <tag/Function/Set the text color.
5361 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5362 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
5363 <tag/Description/The function will set a new text color. It returns the old
5364 (current) text color. Text output using any <tt/conio.h/ function will use
5365 the color set by this function.
5366 <tag/Limits/<itemize>
5367 <item>Text colors are system dependent. The function may have no effect
5368 on systems where the text color cannot be changed.
5369 <item>The function is only available as fastcall function, so it may only
5370 be used in presence of a prototype.
5371 </itemize>
5372 <tag/Availability/cc65
5373 <tag/See also/
5374 <ref id="bgcolor" name="bgcolor">,
5375 <ref id="bordercolor" name="bordercolor">
5376 <tag/Example/None.
5377 </descrip>
5378 </quote>
5379
5380
5381 <sect1>tgi_arc<label id="tgi_arc"><p>
5382
5383 <quote>
5384 <descrip>
5385 <tag/Function/Draw an elliptic arc in the current color.
5386 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5387 <tag/Declaration/<tt/void __fastcall__ tgi_arc (int x, int y,
5388 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
5389 <tag/Description/The function draws an elliptic arc with center at x/y and
5390 radii rx/ry using the current drawing color. The arc covers the angle
5391 between sa and ea (startangle and endangle), which must be in the range
5392 0..360.
5393 <tag/Limits/<itemize>
5394 <item>The function is only available as fastcall function, so it may only
5395 be used in presence of a prototype.
5396 <item>The function behaves unexpectedly or may crash if the angles are out
5397 of range.
5398 </itemize>
5399 <tag/Availability/cc65
5400 <tag/See also/
5401 <ref id="tgi_bar" name="tgi_bar">,
5402 <ref id="tgi_circle" name="tgi_circle">,
5403 <ref id="tgi_ellipse" name="tgi_ellipse">,
5404 <ref id="tgi_pieslice" name="tgi_pieslice">,
5405 <ref id="tgi_setcolor" name="tgi_setcolor">
5406 <tag/Example/<verb>
5407 /* Draw the upper half of an ellipse */
5408 tgi_setcolor(TGI_COLOR_BLUE);
5409 tgi_arc (50, 50, 40, 20, 0, 180);
5410 </verb>
5411 </descrip>
5412 </quote>
5413
5414
5415 <sect1>tgi_bar<label id="tgi_bar"><p>
5416
5417 <quote>
5418 <descrip>
5419 <tag/Function/The function fills a rectangle on the drawpage with the current
5420 color.
5421 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5422 <tag/Declaration/<tt/void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);/
5423 <tag/Description/The function fills a rectangle on the drawpage with the current
5424 color.
5425 <tag/Limits/<itemize>
5426 <item>The function is only available as fastcall function, so it may only
5427 be used in presence of a prototype.
5428 </itemize>
5429 <tag/Availability/cc65
5430 <tag/See also/Other tgi function
5431 <tag/Example/<verb>
5432 tgi_setcolor(TGI_COLOR_GREEN);
5433 tgi_bar(10, 10, 100, 60);
5434 </verb>
5435 </descrip>
5436 </quote>
5437
5438
5439 <sect1>tgi_circle<label id="tgi_circle"><p>
5440
5441 <quote>
5442 <descrip>
5443 <tag/Function/The function draws a circle in the current color.
5444 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5445 <tag/Declaration/<tt/void __fastcall__ tgi_circle (int x, int y, unsigned char radius);/
5446 <tag/Description/The function draws a circle in the current color.
5447 <tag/Limits/<itemize>
5448 <item>The function is only available as fastcall function, so it may only
5449 be used in presence of a prototype.
5450 </itemize>
5451 <tag/Availability/cc65
5452 <tag/See also/
5453 <ref id="tgi_arc" name="tgi_arc">,
5454 <ref id="tgi_bar" name="tgi_bar">,
5455 <ref id="tgi_ellipse" name="tgi_ellipse">,
5456 <ref id="tgi_pieslice" name="tgi_pieslice">,
5457 <ref id="tgi_setcolor" name="tgi_setcolor">
5458 <tag/Example/<verb>
5459 tgi_setcolor(TGI_COLOR_BLACK);
5460 tgi_circle(50, 40, 40);
5461 </verb>
5462 </descrip>
5463 </quote>
5464
5465
5466 <sect1>tgi_clear<label id="tgi_clear"><p>
5467
5468 <quote>
5469 <descrip>
5470 <tag/Function/Clear the drawpage
5471 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5472 <tag/Declaration/<tt/void tgi_clear (void);/
5473 <tag/Description/Clear the drawpage
5474 <tag/Availability/cc65
5475 <tag/See also/Other tgi functions
5476 <tag/Example/None.
5477 </descrip>
5478 </quote>
5479
5480
5481 <sect1>tgi_done<label id="tgi_done"><p>
5482
5483 <quote>
5484 <descrip>
5485 <tag/Function/End graphics mode, switch back to text mode.
5486 Will NOT uninstall or unload the driver!
5487 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5488 <tag/Declaration/<tt/void tgi_done (void);/
5489 <tag/Description/End graphics mode, switch back to text mode.
5490 Will NOT uninstall or unload the driver!
5491 <tag/Availability/cc65
5492 <tag/See also/Other tgi functions
5493 <tag/Example/None.
5494 </descrip>
5495 </quote>
5496
5497
5498 <sect1>tgi_ellipse<label id="tgi_ellipse"><p>
5499
5500 <quote>
5501 <descrip>
5502 <tag/Function/The function draws an ellipse in the current color.
5503 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5504 <tag/Declaration/<tt/void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);/
5505 <tag/Description/The function draws an ellipse at position x/y with radii
5506 rx and ry, using the current drawing color.
5507 <tag/Limits/<itemize>
5508 <item>The function is only available as fastcall function, so it may only
5509 be used in presence of a prototype.
5510 </itemize>
5511 <tag/Availability/cc65
5512 <tag/See also/
5513 <ref id="tgi_arc" name="tgi_arc">,
5514 <ref id="tgi_bar" name="tgi_bar">,
5515 <ref id="tgi_circle" name="tgi_circle">,
5516 <ref id="tgi_pieslice" name="tgi_pieslice">,
5517 <ref id="tgi_setcolor" name="tgi_setcolor">
5518 <tag/Example/<verb>
5519 tgi_setcolor(TGI_COLOR_RED);
5520 tgi_ellipse (50, 40, 40, 20);
5521 </verb>
5522 </descrip>
5523 </quote>
5524
5525
5526 <sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p>
5527
5528 <quote> <descrip> <tag/Function/Return the pixel aspect ratio.
5529 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5530 <tag/Declaration/<tt/unsigned tgi_getaspectratio (void);/
5531 <tag/Description/The function returns the pixel aspect ratio for the current
5532 driver and display as an 8.8 fixed point value. It may be used to correct
5533 geometric shapes so they look correct on the display. As an example, a circle
5534 with a radius of 100 pixels may look elliptic on some driver/display
5535 combinations if the aspect ratio is not 1.00.
5536 <tag/Limits/<itemize>
5537 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
5538 monitor for the given platform. The aspect ratio may be wrong if another
5539 monitor is used.
5540 <item>No TGI function will use the aspect ratio. It is up to the programmer to
5541 make use of it.
5542 <item>The <ref id="tgi_setaspectratio" name="tgi_setaspectratio"> function can
5543 be used to change the aspect ratio for a loaded driver. The value is not reset
5544 by <ref id="tgi_init" name="tgi_init">, so if a driver is linked statically to
5545 an application, switching into and out of graphics mode will not restore the
5546 original aspect ratio.
5547 </itemize>
5548 <tag/Availability/cc65
5549 <tag/See also/
5550 <ref id="tgi_setaspectratio" name="tgi_setaspectratio">
5551 <tag/Example/None.
5552 </descrip>
5553 </quote>
5554
5555
5556 <sect1>tgi_getcolor<label id="tgi_getcolor"><p>
5557
5558 <quote>
5559 <descrip>
5560 <tag/Function/Return the current drawing color.
5561 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5562 <tag/Declaration/<tt/unsigned char tgi_getcolor (void);/
5563 <tag/Description/The actual color is an index to a palette. During tgi_init
5564 you will get a default palette. The number of colors depend on the platform.
5565 All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some
5566 platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN
5567 and then you change the green of the palette to blue using tgi_setpalette then
5568 after this painting in TGI_COLOR_GREEN will actually be blue.
5569 <tag/Availability/cc65
5570 <tag/See also/Other tgi functions
5571 <tag/Example/<verb>
5572 color = tgi_getcolor();
5573 </verb>
5574 </descrip>
5575 </quote>
5576
5577
5578 <sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p>
5579
5580 <quote>
5581 <descrip>
5582 <tag/Function/Get the number of available colors.
5583 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5584 <tag/Declaration/<tt/unsigned char tgi_getcolorcount (void);/
5585 <tag/Description/Tgi platforms use indexed color palettes. This function
5586 returns the number of entries we can use in the palette.
5587 <tag/Availability/cc65
5588 <tag/See also/Other tgi functions
5589 <tag/Example/<verb>
5590 if (tgi_getcolorcount() == 2) {
5591   printf("Only monochrome graphics is supported\n");
5592 }
5593 </verb>
5594 </descrip>
5595 </quote>
5596
5597
5598 <sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p>
5599
5600 <quote>
5601 <descrip>
5602 <tag/Function/Get the palette installed by default.
5603 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5604 <tag/Declaration/<tt/const unsigned char* tgi_getdefpalette (void);/
5605 <tag/Description/The tgi driver has a default palette that is active at startup.
5606 The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this
5607 palette to work correctly.
5608 <tag/Availability/cc65
5609 <tag/See also/Other tgi functions
5610 <tag/Example/None.
5611 </descrip>
5612 </quote>
5613
5614
5615 <sect1>tgi_geterror<label id="tgi_geterror"><p>
5616
5617 <quote>
5618 <descrip>
5619 <tag/Function/Return the error code for the last operation.
5620 This will also clear the error.
5621 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5622 <tag/Declaration/<tt/unsigned char tgi_geterror (void);/
5623 <tag/Description/Return the error code for the last operation.
5624 This will also clear the error.
5625 <tag/Availability/cc65
5626 <tag/See also/Other tgi functions
5627 <tag/Example/None.
5628 </descrip>
5629 </quote>
5630
5631
5632 <sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p>
5633
5634 <quote>
5635 <descrip>
5636 <tag/Function/Get an error message describing the error.
5637 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5638 <tag/Declaration/<tt/const char* __fastcall__ tgi_geterrormsg (unsigned char code);/
5639 <tag/Description/Get an error message describing the error.
5640 <tag/Limits/<itemize>
5641 <item>The function is only available as fastcall function, so it may only
5642 be used in presence of a prototype.
5643 </itemize>
5644 <tag/Availability/cc65
5645 <tag/See also/Other tgi functions
5646 <tag/Example/None.
5647 </descrip>
5648 </quote>
5649
5650
5651 <sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p>
5652
5653 <quote>
5654 <descrip>
5655 <tag/Function/Get the highest index of the palette.
5656 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5657 <tag/Declaration/<tt/unsigned char tgi_getmaxcolor (void);/
5658 <tag/Description/Get the highest index of the palette.
5659 <tag/Availability/cc65
5660 <tag/See also/Other tgi functions
5661 <tag/Example/None.
5662 </descrip>
5663 </quote>
5664
5665
5666 <sect1>tgi_getmaxx<label id="tgi_getmaxx"><p>
5667
5668 <quote>
5669 <descrip>
5670 <tag/Function/Get the maximum x coordinate that can be used on this screen.
5671 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5672 <tag/Declaration/<tt/unsigned tgi_getmaxx (void);/
5673 <tag/Description/Get the maximum x coordinate that can be used on this screen.
5674 <tag/Availability/cc65
5675 <tag/See also/Other tgi functions
5676 <tag/Example/None.
5677 </descrip>
5678 </quote>
5679
5680
5681 <sect1>tgi_getmaxy<label id="tgi_getmaxy"><p>
5682
5683 <quote>
5684 <descrip>
5685 <tag/Function/Get the maximum y coordinate that can be used on this screen.
5686 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5687 <tag/Declaration/<tt/unsigned tgi_getmaxy (void);/
5688 <tag/Description/Get the maximum y coordinate that can be used on this screen.
5689 <tag/Availability/cc65
5690 <tag/See also/Other tgi functions
5691 <tag/Example/None.
5692 </descrip>
5693 </quote>
5694
5695
5696 <sect1>tgi_getpagecount<label id="tgi_getpagecount"><p>
5697
5698 <quote>
5699 <descrip>
5700 <tag/Function/Return the number of screen pages available.
5701 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5702 <tag/Declaration/<tt/unsigned tgi_getpagecount (void);/
5703 <tag/Description/Return the number of screen pages available.
5704 <tag/Availability/cc65
5705 <tag/See also/
5706 <ref id="tgi_setdrawpage" name="tgi_setdrawpage">,
5707 <ref id="tgi_setviewpage" name="tgi_setviewpage">
5708 <tag/Example/None.
5709 </descrip>
5710 </quote>
5711
5712
5713 <sect1>tgi_getpalette<label id="tgi_getpalette"><p>
5714
5715 <quote>
5716 <descrip>
5717 <tag/Function/Get the palette installed.
5718 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5719 <tag/Declaration/<tt/const unsigned char* tgi_getpalette (void);/
5720 <tag/Description/Get the palette installed.
5721 <tag/Availability/cc65
5722 <tag/See also/Other tgi functions
5723 <tag/Example/None.
5724 </descrip>
5725 </quote>
5726
5727
5728 <sect1>tgi_getpixel<label id="tgi_getpixel"><p>
5729
5730 <quote>
5731 <descrip>
5732 <tag/Function/Get the color of a pixel from the viewpage.
5733 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5734 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/
5735 <tag/Description/Get the color of a pixel from the viewpage.
5736 <tag/Limits/<itemize>
5737 <item>The function is only available as fastcall function, so it may only
5738 be used in presence of a prototype.
5739 </itemize>
5740 <tag/Availability/cc65
5741 <tag/See also/Other tgi functions.
5742 <tag/Example/None.
5743 </descrip>
5744 </quote>
5745
5746
5747 <sect1>tgi_getxres<label id="tgi_getxres"><p>
5748
5749 <quote>
5750 <descrip>
5751 <tag/Function/Get number of horisontal pixels on the screen.
5752 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5753 <tag/Declaration/<tt/unsigned tgi_getxres (void);/
5754 <tag/Description/Get number of horisontal pixels on the screen.
5755 This is same as tgi_maxx()+1.
5756 <tag/Availability/cc65
5757 <tag/See also/Other tgi functions.
5758 <tag/Example/None.
5759 </descrip>
5760 </quote>
5761
5762
5763 <sect1>tgi_getyres<label id="tgi_getyres"><p>
5764
5765 <quote>
5766 <descrip>
5767 <tag/Function/Get number of vertical pixels on the screen.
5768 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5769 <tag/Declaration/<tt/unsigned tgi_getyres (void);/
5770 <tag/Description/Get number of vertical pixels on the screen.
5771 This is same as tgi_maxy()+1.
5772 <tag/Availability/cc65
5773 <tag/See also/Other tgi functions.
5774 <tag/Example/None.
5775 </descrip>
5776 </quote>
5777
5778
5779 <sect1>tgi_gotoxy<label id="tgi_gotoxy"><p>
5780
5781 <quote>
5782 <descrip>
5783 <tag/Function/Set graphics cursor at x, y.
5784 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5785 <tag/Declaration/<tt/void __fastcall__ tgi_gotoxy (int x, int y);/
5786 <tag/Description/Set graphics cursor at x, y.
5787 <tag/Limits/<itemize>
5788 <item>The function is only available as fastcall function, so it may only
5789 be used in presence of a prototype.
5790 </itemize>
5791 <tag/Availability/cc65
5792 <tag/See also/Other tgi functions.
5793 <tag/Example/None.
5794 </descrip>
5795 </quote>
5796
5797
5798 <sect1>tgi_init<label id="tgi_init"><p>
5799
5800 <quote>
5801 <descrip>
5802 <tag/Function/Initialize the already loaded graphics driver.
5803 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5804 <tag/Declaration/<tt/void tgi_init (void);/
5805 <tag/Description/The tgi_init function will set the default palette to the
5806 hardware.
5807 <tag/Limits/<itemize>
5808 <item><tt/tgi_init/ will not clear the screen. This allows switching between
5809 text and graphics mode on platforms that have separate memory areas for the
5810 screens. If you want the screen cleared, call <tt/<ref id="tgi_clear"
5811 name="tgi_clear">/ after <tt/tgi_init/.
5812 </itemize>
5813 <tag/Availability/cc65
5814 <tag/See also/Other tgi functions.
5815 <tag/Example/<verb>
5816 extern char lynxtgi[]; //Include the driver statically instead of loading it.
5817 tgi_install(&amp;lynxtgi);
5818 tgi_init(); //Set up the default palette and clear the screen.
5819 </verb>
5820 </descrip>
5821 </quote>
5822
5823
5824 <sect1>tgi_install<label id="tgi_install"><p>
5825
5826 <quote>
5827 <descrip>
5828 <tag/Function/Install an already loaded driver and return an error code.
5829 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5830 <tag/Declaration/<tt/unsigned char __fastcall__ tgi_install (void* driver);/
5831 <tag/Description/The function installs a driver that was already loaded into
5832 memory (or linked statically to the program). It returns an error code
5833 (<tt/TGI_ERR_OK/ in case of success).
5834 <tag/Limits/<itemize>
5835 <item>The function is only available as fastcall function, so it may only be
5836 used in presence of a prototype.
5837 </itemize>
5838 <tag/Availability/cc65
5839 <tag/See also/
5840 <ref id="tgi_load_driver" name="tgi_load_driver">,
5841 <ref id="tgi_uninstall" name="tgi_uninstall">,
5842 <ref id="tgi_unload" name="tgi_unload">
5843 <tag/Example/<verb>
5844 extern char lynxtgi[]; //Include the driver statically instead of loading it.
5845
5846 tgi_install(&amp;lynxtgi);
5847 tgi_init(); //Set up the default palette and clear the screen.
5848 </verb>
5849 </descrip>
5850 </quote>
5851
5852
5853 <sect1>tgi_ioctl<label id="tgi_ioctl"><p>
5854
5855 <quote>
5856 <descrip>
5857 <tag/Function/Platform dependent code extensions.
5858 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5859 <tag/Declaration/<tt/unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);/
5860 <tag/Description/Some platforms have extra display hardware that is not
5861 supported by standard tgi functions. You can extend the driver to support
5862 this extra hardware using tgi_ioctl functions.
5863 <tag/Limits/<itemize>
5864 <item>The function is only available as fastcall function, so it may only
5865 be used in presence of a prototype.
5866 <item>These functions are not easily portable to other cc65 platforms.
5867 </itemize>
5868 <tag/Availability/cc65
5869 <tag/See also/Other tgi functions.
5870 <tag/Example/<verb>
5871 #define tgi_sprite(spr) tgi_ioctl(0, (void*)(spr))
5872 #define tgi_flip() tgi_ioctl(1, (void*)0)
5873 #define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
5874 #define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
5875 #define tgi_busy() tgi_ioctl(4, (void*)0)
5876 #define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
5877 if (!tgi_busy()) {
5878   tgi_sprite(&amp;background);
5879   tgi_setcolor(TGI_COLOR_BLUE);
5880   tgi_outttextxy(20,40,"Hello World");
5881   tgi_updatedisplay();
5882 }
5883 </verb>
5884 </descrip>
5885 </quote>
5886
5887
5888 <sect1>tgi_line<label id="tgi_line"><p>
5889
5890 <quote>
5891 <descrip>
5892 <tag/Function/Draw a line in the current drawing color.
5893 The graphics cursor will be set to x2/y2 by this call.
5894 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5895 <tag/Declaration/<tt/void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);/
5896 <tag/Description/Draw a line in the current drawing color.
5897 The graphics cursor will be set to x2/y2 by this call.
5898 <tag/Limits/<itemize>
5899 <item>The function is only available as fastcall function, so it may only
5900 be used in presence of a prototype.
5901 </itemize>
5902 <tag/Availability/cc65
5903 <tag/See also/Other tgi functions.
5904 <tag/Example/None.
5905 </descrip>
5906 </quote>
5907
5908
5909 <sect1>tgi_lineto<label id="tgi_lineto"><p>
5910
5911 <quote>
5912 <descrip>
5913 <tag/Function/Draw a line in the current drawing color from the graphics
5914 cursor to the new end point. The graphics cursor will be updated to x2/y2.
5915 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5916 <tag/Declaration/<tt/void __fastcall__ tgi_lineto (int x2, int y2);/
5917 <tag/Description/Draw a line in the current drawing color from the graphics
5918 cursor to the new end point. The graphics cursor will be updated to x2/y2.
5919 <tag/Limits/<itemize>
5920 <item>The function is only available as fastcall function, so it may only
5921 be used in presence of a prototype.
5922 </itemize>
5923 <tag/Availability/cc65
5924 <tag/See also/Other tgi functions.
5925 <tag/Example/None.
5926 </descrip>
5927 </quote>
5928
5929
5930 <sect1>tgi_load_driver<label id="tgi_load_driver"><p>
5931
5932 <quote>
5933 <descrip>
5934 <tag/Function/Load and install the given driver.
5935 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5936 <tag/Declaration/<tt/void __fastcall__ tgi_load_driver (const char *name);/
5937 <tag/Description/Load and install the driver by name.
5938 Will just load the driver and check if loading was successful.
5939 Will not switch to graphics mode.
5940 <tag/Limits/<itemize>
5941 <item>The function is only available as fastcall function, so it may only
5942 be used in presence of a prototype.
5943 </itemize>
5944 <tag/Availability/cc65
5945 <tag/See also/Other tgi functions.
5946 <tag/Example/None.
5947 </descrip>
5948 </quote>
5949
5950
5951 <sect1>tgi_outtext<label id="tgi_outtext"><p>
5952
5953 <quote>
5954 <descrip>
5955 <tag/Function/Output text at the current graphics cursor position.
5956 The graphics cursor is moved to the end of the text.
5957 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5958 <tag/Declaration/<tt/void __fastcall__ tgi_outtext (const char* s);/
5959 <tag/Description/Output text at the current graphics cursor position.
5960 The graphics cursor is moved to the end of the text.
5961 <tag/Limits/<itemize>
5962 <item>The function is only available as fastcall function, so it may only
5963 be used in presence of a prototype.
5964 </itemize>
5965 <tag/Availability/cc65
5966 <tag/See also/Other tgi functions.
5967 <tag/Example/None.
5968 </descrip>
5969 </quote>
5970
5971
5972 <sect1>tgi_outtextxy<label id="tgi_outtextxy"><p>
5973
5974 <quote>
5975 <descrip>
5976 <tag/Function/Output text at the given cursor position.
5977 The graphics cursor is moved to the end of the text.
5978 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5979 <tag/Declaration/<tt/void __fastcall__ tgi_outtextxy (int x, int y, const char* s);/
5980 <tag/Description/Output text at the given cursor position.
5981 The graphics cursor is moved to the end of the text.
5982 <tag/Limits/<itemize>
5983 <item>The function is only available as fastcall function, so it may only
5984 be used in presence of a prototype.
5985 </itemize>
5986 <tag/Availability/cc65
5987 <tag/See also/Other tgi functions.
5988 <tag/Example/None.
5989 </descrip>
5990 </quote>
5991
5992
5993 <sect1>tgi_pieslice<label id="tgi_pieslice"><p>
5994
5995 <quote>
5996 <descrip>
5997 <tag/Function/Draw an elliptic pie slice in the current color.
5998 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
5999 <tag/Declaration/<tt/void __fastcall__ tgi_pie slice (int x, int y,
6000 unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/
6001 <tag/Description/The function draws an elliptic pie slice with center at x/y
6002 and radii rx/ry using the current drawing color. The pie slice covers the angle
6003 between sa and ea (startangle and endangle), which must be in the range
6004 0..360.
6005 <tag/Limits/<itemize>
6006 <item>The function is only available as fastcall function, so it may only
6007 be used in presence of a prototype.
6008 <item>The function behaves unexpectedly or may crash if the angles are out
6009 of range.
6010 </itemize>
6011 <tag/Availability/cc65
6012 <tag/See also/
6013 <ref id="tgi_bar" name="tgi_arc">,
6014 <ref id="tgi_bar" name="tgi_bar">,
6015 <ref id="tgi_circle" name="tgi_circle">,
6016 <ref id="tgi_ellipse" name="tgi_ellipse">,
6017 <ref id="tgi_setcolor" name="tgi_setcolor">
6018 <tag/Example/<verb>
6019 /* Draw the closed upper half of an ellipse */
6020 tgi_setcolor(TGI_COLOR_BLUE);
6021 tgi_pieslice (50, 50, 40, 20, 0, 180);
6022 </verb>
6023 </descrip>
6024 </quote>
6025
6026
6027 <sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p>
6028
6029 <quote> <descrip> <tag/Function/Set the pixel aspect ratio.
6030 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6031 <tag/Declaration/<tt/void __fastcall__ tgi_setaspectratio (unsigned ratio);/
6032 <tag/Description/The function sets the pixel aspect ratio for the current
6033 driver and display. The argument is an 8.8 fixed point value. The aspect ratio
6034 may be used to correct geometric shapes so they look correct on a given
6035 display. As an example, a circle with a radius of 100 pixels may look elliptic
6036 on some driver/display combinations if the aspect ratio is not 1.00.
6037 <tag/Limits/<itemize>
6038 <item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
6039 monitor for the given platform. The aspect ratio may be wrong if another
6040 monitor is used.
6041 <item>No TGI function will use the aspect ratio. It is up to the programmer to
6042 make use of it.
6043 <item>The <tt/tgi_setaspectratio/ function can be used to change the aspect
6044 ratio for a loaded driver. The value is not reset by <ref id="tgi_init"
6045 name="tgi_init">, so if a driver is linked statically to an application,
6046 switching into and out of graphics mode will not restore the original aspect
6047 ratio.
6048 </itemize>
6049 <tag/Availability/cc65
6050 <tag/See also/
6051 <ref id="tgi_getaspectratio" name="tgi_getaspectratio">
6052 <tag/Example/None.
6053 </descrip>
6054 </quote>
6055
6056
6057 <sect1>tgi_setcolor<label id="tgi_setcolor"><p>
6058
6059 <quote>
6060 <descrip>
6061 <tag/Function/Set color to be used in future draw operations.
6062 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6063 <tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/
6064 <tag/Description/Set color to be used in future draw operations.
6065 <tag/Limits/<itemize>
6066 <item>The function is only available as fastcall function, so it may only
6067 be used in presence of a prototype.
6068 </itemize>
6069 <tag/Availability/cc65
6070 <tag/See also/Other tgi functions.
6071 <tag/Example/<verb>
6072 tgi_setcolor(TGI_COLOR_BLACK);
6073 tgi_bar(0,0,30,30);
6074 tgi_setcolor(TGI_COLOR_WHITE);
6075 tgi_bar(10,10,20,20);
6076 </verb>
6077 </descrip>
6078 </quote>
6079
6080 <sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p>
6081
6082 <quote>
6083 <descrip>
6084 <tag/Function/Set the page for drawing.
6085 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6086 <tag/Declaration/<tt/void __fastcall__ tgi_setdrawpage (unsigned char page);/
6087 <tag/Description/If the drawpage and the viewpage are the same then all drawing
6088 is seen immediately as it is drawn. For double buffered games you can set the
6089 drawpage to a different page than the viewpage. This lets you draw the next
6090 screen in the background and when the screen is ready you display it.
6091 <tag/Limits/<itemize>
6092 <item>The function is only available as fastcall function, so it may only
6093 be used in presence of a prototype.
6094 </itemize>
6095 <tag/Availability/cc65
6096 <tag/See also/Other tgi functions.
6097 <tag/Example/<verb>
6098 tgi_setdrawpage(1);
6099 tgi_outtextxy(10, 10, "Hello World");
6100 tgi_setviewpage(1); // Show page 1
6101 tgi_setdrawpage(0);
6102 tgi_outtextxy(10, 10, "Creating next frame");
6103 ...
6104 tgi_setviewpage(0); // Show page 0
6105 </verb>
6106 </descrip>
6107 </quote>
6108
6109 <sect1>tgi_setpalette<label id="tgi_setpalette"><p>
6110
6111 <quote>
6112 <descrip>
6113 <tag/Function/Set the palette (not available with all drivers/hardware).
6114 Palette is a pointer to as many entries as there are colors.
6115 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6116 <tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/
6117 <tag/Description/Set the palette (not available with all drivers/hardware).
6118 Palette is a pointer to as many entries as there are colors.
6119 <tag/Limits/<itemize>
6120 <item>The function is only available as fastcall function, so it may only
6121 be used in presence of a prototype.
6122 </itemize>
6123 <tag/Availability/cc65
6124 <tag/See also/Other tgi functions.
6125 <tag/Example/None.
6126 </descrip>
6127 </quote>
6128
6129 <sect1>tgi_setpixel<label id="tgi_setpixel"><p>
6130
6131 <quote>
6132 <descrip>
6133 <tag/Function/Plot a pixel on the drawpage with the current color.
6134 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6135 <tag/Declaration/<tt/void __fastcall__ tgi_setpixel (int x, int y);/
6136 <tag/Description/Plot a pixel on the drawpage with the current color.
6137 <tag/Limits/<itemize>
6138 <item>The function is only available as fastcall function, so it may only
6139 be used in presence of a prototype.
6140 </itemize>
6141 <tag/Availability/cc65
6142 <tag/See also/Other tgi functions.
6143 <tag/Example/None.
6144 </descrip>
6145 </quote>
6146
6147 <sect1>tgi_setviewpage<label id="tgi_setviewpage"><p>
6148
6149 <quote>
6150 <descrip>
6151 <tag/Function/Set page to be visible on screen.
6152 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6153 <tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/
6154 <tag/Description/If the drawpage and the viewpage are the same then all drawing
6155 is seen immediately as it is drawn. For double buffered games you can set the
6156 drawpage to a different page than the viewpage. This lets you draw the next
6157 screen in the background and when the screen is ready you display it.
6158 <tag/Limits/<itemize>
6159 <item>The function is only available as fastcall function, so it may only
6160 be used in presence of a prototype.
6161 </itemize>
6162 <tag/Availability/cc65
6163 <tag/See also/Other tgi functions.
6164 <tag/Example/<verb>
6165 tgi_setdrawpage(1);
6166 tgi_outtextxy(10, 10, "Hello World");
6167 tgi_setviewpage(1); // Show page 1
6168 tgi_setdrawpage(0);
6169 tgi_outtextxy(10, 10, "Creating next frame");
6170 ...
6171 tgi_setviewpage(0); // Show page 0
6172 </verb>
6173 </descrip>
6174 </quote>
6175
6176 <sect1>tgi_gettextheight<label id="tgi_gettextheight"><p>
6177
6178 <quote>
6179 <descrip>
6180 <tag/Function/Calculate the height of the text in pixels according to
6181 the current text style.
6182 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6183 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/
6184 <tag/Description/Calculate the height of the text in pixels according to
6185 the current text style.
6186 <tag/Limits/<itemize>
6187 <item>The function is only available as fastcall function, so it may only
6188 be used in presence of a prototype.
6189 </itemize>
6190 <tag/Availability/cc65
6191 <tag/See also/Other tgi functions.
6192 <tag/Example/None.
6193 </descrip>
6194 </quote>
6195
6196 <sect1>tgi_settextstyle<label id="tgi_settextstyle"><p>
6197
6198 <quote>
6199 <descrip>
6200 <tag/Function/Set the style for text output.
6201 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6202 <tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir);/
6203 <tag/Description/Set the style for text output.
6204 <tag/Limits/<itemize>
6205 <item>The function is only available as fastcall function, so it may only
6206 be used in presence of a prototype.
6207 </itemize>
6208 <tag/Availability/cc65
6209 <tag/See also/Other tgi functions.
6210 <tag/Example/None.
6211 </descrip>
6212 </quote>
6213
6214 <sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p>
6215
6216 <quote>
6217 <descrip>
6218 <tag/Function/Calculate the width of the text in pixels according to the current text style.
6219 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6220 <tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/
6221 <tag/Function/Calculate the width of the text in pixels according to the current text style.
6222 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6223 <tag/Description/Calculate the width of the text in pixels according to the current text style.
6224 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6225 <tag/Limits/<itemize>
6226 <item>The function is only available as fastcall function, so it may only
6227 be used in presence of a prototype.
6228 </itemize>
6229 <tag/Availability/cc65
6230 <tag/See also/Other tgi functions.
6231 <tag/Example/None.
6232 </descrip>
6233 </quote>
6234
6235 <sect1>tgi_uninstall<label id="tgi_uninstall"><p>
6236
6237 <quote>
6238 <descrip>
6239 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6240 Will call tgi_done if necessary.
6241 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6242 <tag/Declaration/<tt/void tgi_uninstall (void);/
6243 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6244 Will call tgi_done if necessary.
6245 <tag/Availability/cc65
6246 <tag/See also/Other tgi functions.
6247 <tag/Example/None.
6248 </descrip>
6249 </quote>
6250
6251 <sect1>tgi_unload<label id="tgi_unload"><p>
6252
6253 <quote>
6254 <descrip>
6255 <tag/Function/Uninstall, then unload the currently loaded driver.
6256 Will call tgi_done if necessary.
6257 <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
6258 <tag/Declaration/<tt/void tgi_unload (void);/
6259 <tag/Description/Uninstall, then unload the currently loaded driver.
6260 Will call tgi_done if necessary.
6261 <tag/Availability/cc65
6262 <tag/See also/Other tgi functions.
6263 <tag/Example/None.
6264 </descrip>
6265 </quote>
6266
6267 <sect1>time<label id="time"><p>
6268
6269 <quote>
6270 <descrip>
6271 <tag/Function/Get the time.
6272 <tag/Header/<tt/<ref id="time.h" name="time.h">/
6273 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
6274 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
6275 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
6276 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
6277 returned and <tt/errno/ is set to <tt/ENOSYS/.
6278 <tag/Limits/<itemize>
6279 <item>The function is only available as fastcall function, so it may
6280 only be used in presence of a prototype.
6281 <item>Many platforms supported by cc65 do not have a realtime clock, so the
6282 returned value may not be valid.
6283 </itemize>
6284 <tag/Availability/ISO 9899
6285 <tag/See also/
6286 <ref id="clock" name="clock">
6287 <tag/Example/None.
6288 </descrip>
6289 </quote>
6290
6291
6292 <sect1>toggle_videomode<label id="toggle_videomode"><p>
6293
6294 <quote>
6295 <descrip>
6296 <tag/Function/Toggle between 40 and 80 column mode.
6297 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
6298 <tag/Declaration/<tt/void toggle_videomode (void);/
6299 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
6300 old mode (cursor position, color and so on) are saved and restored together
6301 with the mode.
6302 <tag/Limits/<itemize>
6303 <item>The function is specific to the C128.
6304 <item>This function is deprecated. Please use <ref id="videomode"
6305 name="videomode"> instead!
6306 </itemize>
6307 <tag/Availability/C128
6308 <tag/See also/
6309 <ref id="fast" name="fast">,
6310 <ref id="slow" name="slow">,
6311 <ref id="videomode" name="videomode">
6312 <tag/Example/None.
6313 </descrip>
6314 </quote>
6315
6316
6317 <sect1>tolower<label id="tolower"><p>
6318
6319 <quote>
6320 <descrip>
6321 <tag/Function/Convert a character into its lower case representation.
6322 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
6323 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
6324 <tag/Description/The function returns the given character converted to lower
6325 case. If the given character is not a letter, it is returned unchanged.
6326 <tag/Limits/<itemize>
6327 <item>The function is only available as fastcall function, so it may
6328 only be used in presence of a prototype.
6329 </itemize>
6330 <tag/Availability/ISO 9899
6331 <tag/See also/
6332 <ref id="islower" name="islower">,
6333 <ref id="isupper" name="isupper">,
6334 <ref id="toupper" name="toupper">
6335 <tag/Example/None.
6336 </descrip>
6337 </quote>
6338
6339
6340 <sect1>toupper<label id="toupper"><p>
6341
6342 <quote>
6343 <descrip>
6344 <tag/Function/Convert a character into its upper case representation.
6345 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
6346 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
6347 <tag/Description/The function returns the given character converted to upper
6348 case. If the given character is not a letter, it is returned unchanged.
6349 <tag/Limits/<itemize>
6350 <item>The function is only available as fastcall function, so it may
6351 only be used in presence of a prototype.
6352 </itemize>
6353 <tag/Availability/ISO 9899
6354 <tag/See also/
6355 <ref id="islower" name="islower">,
6356 <ref id="isupper" name="isupper">,
6357 <ref id="tolower" name="tolower">
6358 <tag/Example/None.
6359 </descrip>
6360 </quote>
6361
6362
6363 <sect1>ultoa<label id="ultoa"><p>
6364
6365 <quote>
6366 <descrip>
6367 <tag/Function/Convert an unsigned long integer into a string.
6368 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6369 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
6370 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
6371 string using <tt/radix/ as the base.
6372 <tag/Limits/<itemize>
6373 <item>There are no provisions to prevent a buffer overflow.
6374 <item>The function is non standard, so it is not available in strict ANSI mode.
6375 You should probably use <tt/sprintf/ instead.
6376 <item>The function is only available as fastcall function, so it may only be
6377 used in presence of a prototype.
6378 </itemize>
6379 <tag/Availability/cc65
6380 <tag/See also/
6381 <ref id="atoi" name="atoi">,
6382 <ref id="atol" name="atol">,
6383 <ref id="itoa" name="itoa">,
6384 <ref id="ltoa" name="ltoa">,
6385 <ref id="utoa" name="utoa">
6386 <tag/Example/None.
6387 </descrip>
6388 </quote>
6389
6390
6391 <sect1>unlink<label id="unlink"><p>
6392
6393 <quote>
6394 <descrip>
6395 <tag/Function/Delete a file.
6396 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6397 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
6398 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
6399 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
6400 code describing the reason for the failure.
6401 <tag/Limits/
6402 <itemize>
6403 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
6404 name="remove">/ instead, which is a native ANSI C function and does the same.
6405 <item>This function is not available on all cc65 targets (depends on the
6406 availability of file I/O).
6407 <item>The function is only available as fastcall function, so it may only
6408 be used in presence of a prototype.
6409 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
6410 used, which has the same semantics, but is more portable, because it conforms
6411 to the ISO C standard.
6412 </itemize>
6413 <tag/Availability/POSIX 1003.1
6414 <tag/See also/
6415 <ref id="remove" name="remove">
6416 <tag/Example/
6417 <verb>
6418 #include &lt;stdio.h&gt;
6419 #include &lt;unistd.h&gt;
6420
6421 #define FILENAME "helloworld"
6422
6423 if (unlink (FILENAME) == 0) {
6424     printf ("We deleted %s successfully\n", FILENAME);
6425 } else {
6426     printf ("There was a problem deleting %s\n", FILENAME);
6427 }
6428 </verb>
6429 </descrip>
6430 </quote>
6431
6432
6433 <sect1>utoa<label id="utoa"><p>
6434
6435 <quote>
6436 <descrip>
6437 <tag/Function/Convert an unsigned integer into a string.
6438 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6439 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
6440 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
6441 using <tt/radix/ as the base.
6442 <tag/Limits/<itemize>
6443 <item>There are no provisions to prevent a buffer overflow.
6444 <item>The function is non standard, so it is not available in strict ANSI mode.
6445 You should probably use <tt/sprintf/ instead.
6446 <item>The function is only available as fastcall function, so it may only be
6447 used in presence of a prototype.
6448 </itemize>
6449 <tag/Availability/cc65
6450 <tag/See also/
6451 <ref id="atoi" name="atoi">,
6452 <ref id="atol" name="atol">,
6453 <ref id="itoa" name="itoa">,
6454 <ref id="ltoa" name="ltoa">,
6455 <ref id="ultoa" name="ultoa">
6456 <tag/Example/None.
6457 </descrip>
6458 </quote>
6459
6460
6461 <sect1>vcprintf<label id="vcprintf"><p>
6462
6463 <quote>
6464 <descrip>
6465 <tag/Function/Formatted output to the console.
6466 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6467 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
6468 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
6469 text where necessary and formatted according to the format string given. The
6470 resulting string is output to the console. <tt/vcprintf/ supports the same
6471 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
6472 <tag/Limits/<itemize>
6473 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
6474 between <tt/\r/ and <tt/\n/.
6475 <item>The function is only available as fastcall function, so it may only be
6476 used in presence of a prototype.
6477 </itemize>
6478 <tag/Availability/cc65
6479 <tag/See also/
6480 <ref id="cprintf" name="cprintf">,
6481 <ref id="cputc" name="cputc">,
6482 <ref id="cputcxy" name="cputcxy">,
6483 <ref id="cputs" name="cputs">,
6484 <ref id="cputsxy" name="cputsxy">
6485 <tag/Example/None.
6486 </descrip>
6487 </quote>
6488
6489
6490 <sect1>videomode<label id="videomode"><p>
6491
6492 <quote>
6493 <descrip>
6494 <tag/Function/Switch to either 40 or 80 column mode.
6495 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
6496 <ref id="c128.h" name="c128.h">/
6497 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
6498 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
6499 the requested mode is already active, nothing happens. The old mode is returned
6500 from the call.
6501 <tag/Limits/<itemize>
6502 <item>The function is specific to the C128 and enhanced Apple //e.
6503 <item>This function replaces <ref id="toggle_videomode"
6504 name="toggle_videomode">.
6505 <item>The function is only available as fastcall function, so it may only be
6506 used in presence of a prototype.
6507 </itemize>
6508 <tag/Availability/C128 and enhanced Apple //e
6509 <tag/See also/
6510 <ref id="fast" name="fast">,
6511 <ref id="slow" name="slow">,
6512 <ref id="toggle_videomode" name="toggle_videomode">
6513 <tag/Example/None.
6514 </descrip>
6515 </quote>
6516
6517
6518 <sect1>wherex<label id="wherex"><p>
6519
6520 <quote>
6521 <descrip>
6522 <tag/Function/Return the current X position of the text mode cursor.
6523 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6524 <tag/Declaration/<tt/unsigned char wherex (void);/
6525 <tag/Description/The function returns the current X position of the text mode
6526 cursor. Zero is returned for the leftmost screen position.
6527 <tag/Availability/cc65
6528 <tag/See also/
6529 <ref id="gotox" name="gotox">,
6530 <ref id="gotoy" name="gotoy">,
6531 <ref id="gotoxy" name="gotoxy">,
6532 <ref id="wherey" name="wherey">
6533 <tag/Example/None.
6534 </descrip>
6535 </quote>
6536
6537
6538 <sect1>wherey<label id="wherey"><p>
6539
6540 <quote>
6541 <descrip>
6542 <tag/Function/Return the current Y position of the text mode cursor.
6543 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6544 <tag/Declaration/<tt/unsigned char wherey (void);/
6545 <tag/Description/The function returns the current Y position of the text mode
6546 cursor. Zero is returned for the uppermost screen position.
6547 <tag/Availability/cc65
6548 <tag/See also/
6549 <ref id="gotox" name="gotox">,
6550 <ref id="gotoy" name="gotoy">,
6551 <ref id="gotoxy" name="gotoxy">,
6552 <ref id="wherex" name="wherex">
6553 <tag/Example/None.
6554 </descrip>
6555 </quote>
6556
6557
6558 </article>