]> git.sur5r.net Git - cc65/blob - doc/funcref.sgml
5e8775c1a78b3ff9b6dd6058e56b84f5259899d7
[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="set_brk" name="set_brk">
62 </itemize>
63
64
65 <sect1><tt/apple2.h/<label id="apple2.h"><p>
66
67
68 <sect1><tt/atari.h/<label id="atari.h"><p>
69
70
71 <sect1><tt/atmos.h/<label id="atmos.h"><p>
72
73
74 <sect1><tt/assert.h/<label id="assert.h"><p>
75
76 <itemize>
77 <item><ref id="assert" name="assert">
78 </itemize>
79
80
81 <sect1><tt/c128.h/<label id="c128.h"><p>
82
83 <itemize>
84 <item><ref id="c64mode" name="c64mode">
85 <item><ref id="fast" name="fast">
86 <item><ref id="toggle_videomode" name="toggle_videomode">
87 <item><ref id="slow" name="slow">
88 </itemize>
89
90
91 <sect1><tt/c16.h/<label id="c16.h"><p>
92
93
94 <sect1><tt/c64.h/<label id="c64.h"><p>
95
96
97 <sect1><tt/conio.h/<label id="conio.h"><p>
98
99 <itemize>
100 <item><ref id="bgcolor" name="bgcolor">
101 <item><ref id="bordercolor" name="bordercolor">
102 <item><ref id="cclear" name="cclear">
103 <item><ref id="cclearxy" name="cclearxy">
104 <item><ref id="cgetc" name="cgetc">
105 <item><ref id="chline" name="chline">
106 <item><ref id="chlinexy" name="chlinexy">
107 <item><ref id="clrscr" name="clrscr">
108 <item><ref id="cprintf" name="cprintf">
109 <item><ref id="cputc" name="cputc">
110 <item><ref id="cputcxy" name="cputcxy">
111 <item><ref id="cputs" name="cputs">
112 <item><ref id="cputsxy" name="cputsxy">
113 <item><ref id="cursor" name="cursor">
114 <item><ref id="cvline" name="cvline">
115 <item><ref id="cvlinexy" name="cvlinexy">
116 <item><ref id="gotox" name="gotox">
117 <item><ref id="gotoxy" name="gotoxy">
118 <item><ref id="gotoy" name="gotoy">
119 <item><ref id="kbhit" name="kbhit">
120 <item><ref id="revers" name="revers">
121 <item><ref id="screensize" name="screensize">
122 <item><ref id="textcolor" name="textcolor">
123 <item><ref id="vcprintf" name="vcprintf">
124 <item><ref id="wherex" name="wherex">
125 <item><ref id="wherey" name="wherey">
126 </itemize>
127
128
129 <sect1><tt/ctype.h/<label id="ctype.h"><p>
130
131 <itemize>
132 <item><ref id="isalnum" name="isalnum">
133 <item><ref id="isalpha" name="isalpha">
134 <item><ref id="isascii" name="isascii">
135 <item><ref id="isblank" name="isblank">
136 <item><ref id="iscntrl" name="iscntrl">
137 <item><ref id="isdigit" name="isdigit">
138 <item><ref id="isgraph" name="isgraph">
139 <item><ref id="islower" name="islower">
140 <item><ref id="isprint" name="isprint">
141 <item><ref id="ispunct" name="ispunct">
142 <item><ref id="isspace" name="isspace">
143 <item><ref id="isupper" name="isupper">
144 <item><ref id="isxdigit" name="isxdigit">
145 <item><ref id="tolower" name="tolower">
146 <item><ref id="toupper" name="toupper">
147 </itemize>
148
149
150 <sect1><tt/dbg.h/<label id="dbg.h"><p>
151
152
153 <sect1><tt/dio.h/<label id="dio.h"><p>
154
155
156 <sect1><tt/em.h/<label id="em.h"><p>
157
158 <itemize>
159 <item><ref id="em_commit" name="em_commit">
160 <item><ref id="em_copyfrom" name="em_copyfrom">
161 <item><ref id="em_copyto" name="em_copyto">
162 <item><ref id="em_load_driver" name="em_load_driver">
163 <item><ref id="em_map" name="em_map">
164 <item><ref id="em_pagecount" name="em_pagecount">
165 <item><ref id="em_unload" name="em_unload">
166 <item><ref id="em_use" name="em_use">
167 </itemize>
168
169
170 <sect1><tt/errno.h/<label id="errno.h"><p>
171
172
173 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
174
175 <itemize>
176 <item><ref id="close" name="close">
177 <item><ref id="creat" name="creat">
178 <item><ref id="open" name="open">
179 </itemize>
180
181
182 <sect1><tt/geos.h/<label id="geos.h"><p>
183
184
185 <sect1><tt/joystick.h/<label id="joystick.h"><p>
186
187
188 <sect1><tt/locale.h/<label id="locale.h"><p>
189
190 <itemize>
191 <item><ref id="localeconv" name="localeconv">
192 <item><ref id="setlocale" name="setlocale">
193 </itemize>
194
195
196 <sect1><tt/modload.h/<label id="modload.h"><p>
197
198 <itemize>
199 <item><ref id="mod_load" name="mod_load">
200 <item><ref id="mod_free" name="mod_free">
201 </itemize>
202
203
204 <sect1><tt/mouse.h/<label id="mouse.h"><p>
205
206 <!-- <itemize> -->
207 <!-- <item><ref id="mouse_load_driver" name="mouse_load_driver"> -->
208 <!-- <item><ref id="mouse_unload" name="mouse_unload"> -->
209 <!-- <item><ref id="mouse_install" name="mouse_install"> -->
210 <!-- <item><ref id="mouse_uninstall" name="mouse_uninstall"> -->
211 <!-- <item><ref id="mouse_hide" name="mouse_hide"> -->
212 <!-- <item><ref id="mouse_show" name="mouse_show"> -->
213 <!-- <item><ref id="mouse_box" name="mouse_box"> -->
214 <!-- <item><ref id="mouse_move" name="mouse_move"> -->
215 <!-- <item><ref id="mouse_buttons" name="mouse_buttons"> -->
216 <!-- <item><ref id="mouse_pos" name="mouse_pos"> -->
217 <!-- <item><ref id="mouse_info" name="mouse_info"> -->
218 <!-- <item><ref id="mouse_ioctl" name="mouse_ioctl"> -->
219 <!-- </itemize> -->
220
221
222 <sect1><tt/nes.h/<label id="nes.h"><p>
223
224
225 <sect1><tt/o65.h/<label id="o65.h"><p>
226
227
228 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
229
230 <itemize>
231 <item><ref id="PEEK" name="PEEK">
232 <item><ref id="PEEKW" name="PEEKW">
233 <item><ref id="POKE" name="POKE">
234 <item><ref id="POKEW" name="POKEW">
235 </itemize>
236
237
238 <sect1><tt/pet.h/<label id="pet.h"><p>
239
240
241 <sect1><tt/plus4.h/<label id="plus4.h"><p>
242
243
244 <sect1><tt/serial.h/<label id="serial.h"><p>
245
246
247 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
248
249
250 <sect1><tt/signal.h/<label id="signal.h"><p>
251
252 <itemize>
253 <item><ref id="raise" name="raise">
254 <item><ref id="signal" name="signal">
255 </itemize>
256
257
258 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
259
260
261 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
262
263
264 <sect1><tt/stddef.h/<label id="stddef.h"><p>
265
266 <itemize>
267 <item><ref id="offsetof" name="offsetof">
268 </itemize>
269
270
271 <sect1><tt/stdio.h/<label id="stdio.h"><p>
272
273 <itemize>
274 <item><ref id="clearerr" name="clearerr">
275 <!-- <item><ref id="fclose" name="fclose"> -->
276 <!-- <item><ref id="fdopen" name="fdopen"> -->
277 <item><ref id="feof" name="feof">
278 <item><ref id="ferror" name="ferror">
279 <!-- <item><ref id="fflush" name="fflush"> -->
280 <!-- <item><ref id="fgetc" name="fgetc"> -->
281 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
282 <!-- <item><ref id="fgets" name="fgets"> -->
283 <item><ref id="fileno" name="fileno">
284 <!-- <item><ref id="flushall" name="flushall"> -->
285 <!-- <item><ref id="fopen" name="fopen"> -->
286 <!-- <item><ref id="fprintf" name="fprintf"> -->
287 <!-- <item><ref id="fputc" name="fputc"> -->
288 <!-- <item><ref id="fputs" name="fputs"> -->
289 <!-- <item><ref id="fread" name="fread"> -->
290 <!-- <item><ref id="freopen" name="freopen"> -->
291 <!-- <item><ref id="fscanf" name="fscanf"> -->
292 <!-- <item><ref id="fseek" name="fseek"> -->
293 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
294 <!-- <item><ref id="ftell" name="ftell"> -->
295 <!-- <item><ref id="fwrite" name="fwrite"> -->
296 <!-- <item><ref id="getc" name="getc"> -->
297 <!-- <item><ref id="getchar" name="getchar"> -->
298 <!-- <item><ref id="gets" name="gets"> -->
299 <!-- <item><ref id="printf" name="printf"> -->
300 <!-- <item><ref id="putc" name="putc"> -->
301 <!-- <item><ref id="putchar" name="putchar"> -->
302 <!-- <item><ref id="puts" name="puts"> -->
303 <!-- <item><ref id="rename" name="rename"> -->
304 <!-- <item><ref id="rewind" name="rewind"> -->
305 <!-- <item><ref id="scanf" name="scanf"> -->
306 <!-- <item><ref id="sprintf" name="sprintf"> -->
307 <!-- <item><ref id="sscanf" name="sscanf"> -->
308 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
309 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
310 <!-- <item><ref id="vprintf" name="vprintf"> -->
311 <!-- <item><ref id="vscanf" name="vscanf"> -->
312 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
313 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
314 </itemize>
315
316
317 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
318
319 <itemize>
320 <item><ref id="_heapadd" name="_heapadd">
321 <item><ref id="_heapblocksize" name="_heapblocksize">
322 <item><ref id="_heapmaxavail" name="_heapmaxavail">
323 <item><ref id="_heapmemavail" name="_heapmemavail">
324 <item><ref id="_poserror" name="_poserror">
325 <item><ref id="_randomize" name="_randomize">
326 <item><ref id="_swap" name="_swap">
327 <item><ref id="abort" name="abort">
328 <item><ref id="abs" name="abs">
329 <item><ref id="atexit" name="atexit">
330 <item><ref id="atoi" name="atoi">
331 <item><ref id="atol" name="atol">
332 <item><ref id="bsearch" name="bsearch">
333 <item><ref id="calloc" name="calloc">
334 <item><ref id="div" name="div">
335 <item><ref id="exit" name="exit">
336 <item><ref id="free" name="free">
337 <item><ref id="getenv" name="getenv">
338 <item><ref id="itoa" name="itoa">
339 <item><ref id="labs" name="labs">
340 <item><ref id="ltoa" name="ltoa">
341 <item><ref id="malloc" name="malloc">
342 <item><ref id="perror" name="perror">
343 <item><ref id="qsort" name="qsort">
344 <item><ref id="rand" name="rand">
345 <item><ref id="realloc" name="realloc">
346 <item><ref id="remove" name="remove">
347 <item><ref id="srand" name="srand">
348 <item><ref id="ultoa" name="ultoa">
349 <item><ref id="utoa" name="utoa">
350 </itemize>
351
352
353 <sect1><tt/string.h/<label id="string.h"><p>
354
355 <itemize>
356 <item><ref id="_stroserror" name="_stroserror">
357 <item><ref id="bzero" name="bzero">
358 <item><ref id="memchr" name="memchr">
359 <item><ref id="memcpy" name="memcpy">
360 <item><ref id="memmove" name="memmove">
361 <item><ref id="memset" name="memset">
362 <item><ref id="strcasecmp" name="strcasecmp">
363 <item><ref id="strcat" name="strcat">
364 <item><ref id="strchr" name="strchr">
365 <item><ref id="strcmp" name="strcmp">
366 <item><ref id="strcoll" name="strcoll">
367 <item><ref id="strcpy" name="strcpy">
368 <item><ref id="strcspn" name="strcspn">
369 <item><ref id="strdup" name="strdup">
370 <item><ref id="strerror" name="strerror">
371 <item><ref id="stricmp" name="stricmp">
372 <item><ref id="strlen" name="strlen">
373 <item><ref id="strlower" name="strlower">
374 <item><ref id="strlwr" name="strlwr">
375 <item><ref id="strncat" name="strncat">
376 <item><ref id="strncmp" name="strncmp">
377 <item><ref id="strncpy" name="strncpy">
378 <item><ref id="strrchr" name="strrchr">
379 <item><ref id="strspn" name="strspn">
380 <item><ref id="strstr" name="strstr">
381 <!-- <item><ref id="strtok" name="strtok"> -->
382 <!-- <item><ref id="strxfrm" name="strxfrm"> -->
383 <item><ref id="strupper" name="strupper">
384 <item><ref id="strupr" name="strupr">
385 </itemize>
386
387
388 <sect1><tt/tgi.h/<label id="tgi.h"><p>
389
390
391 <sect1><tt/time.h/<label id="time.h"><p>
392
393 <itemize>
394 <!-- <item><ref id="_systime" name="_systime"> -->
395 <!-- <item><ref id="asctime" name="asctime"> -->
396 <!-- <item><ref id="clock" name="clock"> -->
397 <!-- <item><ref id="ctime" name="ctime"> -->
398 <!-- <item><ref id="gmtime" name="gmtime"> -->
399 <!-- <item><ref id="localtime" name="localtime"> -->
400 <!-- <item><ref id="mktime" name="mktime"> -->
401 <!-- <item><ref id="strftime" name="strftime"> -->
402 <item><ref id="time" name="time">
403 </itemize>
404
405
406 <sect1><tt/unistd.h/<label id="unistd.h"><p>
407
408 <itemize>
409 <!-- <item><ref id="chdir" name="chdir"> -->
410 <!-- <item><ref id="getcwd" name="getcwd"> -->
411 <!-- <item><ref id="lseek" name="lseek"> -->
412 <!-- <item><ref id="mkdir" name="mkdir"> -->
413 <!-- <item><ref id="read" name="read"> -->
414 <!-- <item><ref id="rmdir" name="rmdir"> -->
415 <item><ref id="sleep" name="sleep">
416 <item><ref id="unlink" name="unlink">
417 <!-- <item><ref id="write" name="write"> -->
418 </itemize>
419
420
421 <sect1><tt/vic20.h/<label id="vic20.h"><p>
422
423
424 <sect1><tt/zlib.h/<label id="zlib.h"><p>
425
426
427
428
429 <sect>Alphabetical function reference<p>
430
431 <sect1>_heapadd<label id="_heapadd"><p>
432
433 <quote>
434 <descrip>
435 <tag/Function/Add a block to the heap.
436 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
437 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
438 <tag/Description/The function adds a block of raw memory to the heap.
439 <tag/Limits/
440 <itemize>
441 <item>The minimum blocksize that can be added is 6 bytes; the function will
442 ignore blocks with smaller sizes.
443 </itemize>
444 <tag/Availability/cc65
445 <tag/See also/
446 <ref id="_heapblocksize" name="_heapblocksize">,
447 <ref id="_heapmaxavail" name="_heapmaxavail">,
448 <ref id="_heapmemavail" name="_heapmemavail">,
449 <ref id="calloc" name="calloc">,
450 <ref id="free" name="free">,
451 <ref id="malloc" name="malloc">,
452 <ref id="realloc" name="realloc">
453 <tag/Example/None.
454 </descrip>
455 </quote>
456
457
458 <sect1>_heapblocksize<label id="_heapblocksize"><p>
459
460 <quote>
461 <descrip>
462 <tag/Function/Return the size of an allocated block.
463 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
464 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
465 <tag/Description/The function returns the size of a block that must have
466 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
467 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
468 <tag/Limits/
469 <itemize>
470 <item>Passing a pointer to a block that was is not the result of one of the
471 allocation functions, or that has been free'd will give unpredicable results.
472 </itemize>
473 <tag/Availability/cc65
474 <tag/See also/
475 <ref id="_heapadd" name="_heapadd">,
476 <ref id="_heapmaxavail" name="_heapmaxavail">,
477 <ref id="_heapmemavail" name="_heapmemavail">,
478 <ref id="calloc" name="calloc">,
479 <ref id="free" name="free">,
480 <ref id="malloc" name="malloc">,
481 <ref id="realloc" name="realloc">
482 <tag/Example/None.
483 </descrip>
484 </quote>
485
486
487 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
488
489 <quote>
490 <descrip>
491 <tag/Function/Return the largest block that is available on the heap.
492 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
493 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
494 <tag/Description/The function returns the size of the largest block that may
495 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
496 <tag/Availability/cc65
497 <tag/See also/
498 <ref id="_heapadd" name="_heapadd">,
499 <ref id="_heapblocksize" name="_heapblocksize">,
500 <ref id="_heapmemavail" name="_heapmemavail">,
501 <ref id="calloc" name="calloc">,
502 <ref id="free" name="free">,
503 <ref id="malloc" name="malloc">,
504 <ref id="realloc" name="realloc">
505 <tag/Example/None.
506 </descrip>
507 </quote>
508
509
510 <sect1>_heapmemavail<label id="_heapmemavail"><p>
511
512 <quote>
513 <descrip>
514 <tag/Function/Return the total available space on the heap.
515 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
516 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
517 <tag/Description/The function returns the total number of bytes available on
518 the heap.
519 <tag/Limits/
520 <itemize>
521 <item>This function is of less use than usually assumed, since the returned
522 heap space may be available but not in one block. So even if this function
523 says that several times more heap space is available than needed, <ref
524 id="malloc" name="malloc"> may still return <tt/NULL/.
525 </itemize>
526 <tag/Availability/cc65
527 <tag/See also/
528 <ref id="_heapadd" name="_heapadd">,
529 <ref id="_heapblocksize" name="_heapblocksize">,
530 <ref id="_heapmaxavail" name="_heapmaxavail">,
531 <ref id="calloc" name="calloc">,
532 <ref id="free" name="free">,
533 <ref id="malloc" name="malloc">,
534 <ref id="realloc" name="realloc">
535 <tag/Example/None.
536 </descrip>
537 </quote>
538
539
540 <sect1>_poserror<label id="_poserror"><p>
541
542 <quote>
543 <descrip>
544 <tag/Function/Print an error message for the error in <tt/_oserrno/.
545 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
546 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
547 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
548 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
549 a colon and a blank. Then the error message for the current contents of
550 <tt/_oserrno/ are printed followed by a newline. The message output is the
551 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
552 argument of <tt/_oserrno/.
553 <tag/Limits/
554 <itemize>
555 <item>Since operating system specific error code are - you guessed it -
556 operating system specific, the value in <tt/_oserror/ and the message that is
557 printed depend on the cc65 target.
558 <item>The function is only available as fastcall function, so it may only
559 be used in presence of a prototype.
560 </itemize>
561 <tag/Availability/cc65
562 <tag/See also/
563 <ref id="_stroserror" name="_stroserror">,
564 <ref id="perror" name="perror">
565 <tag/Example/None.
566 </descrip>
567 </quote>
568
569
570 <sect1>_randomize<label id="_randomize"><p>
571
572 <quote>
573 <descrip>
574 <tag/Function/Initialize the pseudo random number generator.
575 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
576 <tag/Declaration/<tt/void _randomize (void);/
577 <tag/Description/The function initializes the random number generator with
578 a seed derived from fast changing hardware events, so the seed itself can be
579 considered random to a certain degree.
580 <tag/Limits/<itemize>
581 <item>The randomness of the seed depends on the machine hardware.
582 </itemize>
583 <tag/Availability/cc65
584 <tag/See also/
585 <ref id="rand" name="rand">,
586 <ref id="srand" name="srand">
587 <tag/Example/None.
588 </descrip>
589 </quote>
590
591
592 <sect1>_stroserror<label id="_stroserror"><p>
593
594 <quote>
595 <descrip>
596 <tag/Function/Return a string describing an OS specific error code.
597 <tag/Header/<tt/<ref id="string.h" name="string.h">/
598 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
599 <tag/Description/<tt/_stroserror/ will return a string describing the given
600 operating system specific error code.
601 <tag/Limits/<itemize>
602 <item>Since operating system specific error code are - you guessed it -
603 operating system specific, the parameter and the string returned depend on the
604 cc65 target.
605 <item>The function is only available as fastcall function, so it may only be
606 used in presence of a prototype.
607 </itemize>
608 <tag/Availability/cc65
609 <tag/See also/
610 <ref id="strerror" name="strerror">
611 <tag/Example/None.
612 </descrip>
613 </quote>
614
615
616 <sect1>_swap<label id="_swap"><p>
617
618 <quote>
619 <descrip>
620 <tag/Function/Swap the contents of memory areas.
621 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
622 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
623 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
624 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
625 <tt/size/ bytes in size.
626 <tag/Limits/<itemize>
627 <item>The memory areas may not overlap, otherwise the results are undefined.
628 <item>The function is only available as fastcall function, so it may only be
629 used in presence of a prototype.
630 </itemize>
631 <tag/Availability/cc65
632 <tag/See also/
633 <ref id="memcpy" name="memcpy">,
634 <ref id="memmove" name="memmove">
635 <tag/Example/None.
636 </descrip>
637 </quote>
638
639
640 <sect1>_sys<label id="_sys"><p>
641
642 <quote>
643 <descrip>
644 <tag/Function/Call a subroutine passing register values.
645 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
646 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
647 <tag/Description/The function will call the subroutine at the address
648 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
649 registers and the CPU flags are set to the values given in the <tt/regs/
650 structure. On return from the subroutine, the new values of the registers and
651 flags are stored back overwriting the old values.
652 <tag/Limits/<itemize>
653 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
654 when calling the subroutine (they are unchanged from their current values).
655 <item>The function is only available as fastcall function, so it may only be
656 used in presence of a prototype.
657 </itemize>
658 <tag/Availability/cc65
659 <tag/Example/None.
660 </descrip>
661 </quote>
662
663
664 <sect1>BRK<label id="BRK"><p>
665
666 <quote>
667 <descrip>
668 <tag/Function/Insert a 6502 BRK instrunction into the code.
669 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
670 <tag/Declaration/<tt/void BRK (void);/
671 <tag/Description/The function will insert a 6502 BRK instruction into the code
672 which may be used to trigger a debugger.
673 <tag/Limits/<itemize>
674 <item>The function is actually a macro.
675 <item>The inserted instruction may lead to unexpected results if no debugger
676 is present.
677 </itemize>
678 <tag/Availability/cc65
679 <tag/See also/
680 <ref id="CLI" name="CLI">,
681 <ref id="SEI" name="SEI">
682 <tag/Example/None.
683 </descrip>
684 </quote>
685
686
687 <sect1>CLI<label id="CLI"><p>
688
689 <quote>
690 <descrip>
691 <tag/Function/Insert a 6502 CLI instrunction into the code.
692 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
693 <tag/Declaration/<tt/void CLI (void);/
694 <tag/Description/The function will insert a 6502 CLI instruction into the code,
695 so interrupts are disabled. Note that non maskable interrupts cannot be
696 disabled.
697 <tag/Limits/<itemize>
698 <item>The function is actually a macro.
699 <item>Disabling interrupts may lead to unexpected results.
700 </itemize>
701 <tag/Availability/cc65
702 <tag/See also/
703 <ref id="BRK" name="BRK">,
704 <ref id="SEI" name="SEI">
705 <tag/Example/None.
706 </descrip>
707 </quote>
708
709
710 <sect1>PEEK<label id="PEEK"><p>
711
712 <quote>
713 <descrip>
714 <tag/Function/Read a byte from memory.
715 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
716 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
717 <tag/Description/The function will read the absolute memory given by <tt/addr/
718 and return the value read.
719 <tag/Limits/<itemize>
720 <item>The function is actually a macro.
721 <item>This function depends highly on the platform and environment.
722 </itemize>
723 <tag/Availability/cc65
724 <tag/See also/
725 <ref id="PEEKW" name="PEEKW">,
726 <ref id="POKE" name="POKE">
727 <tag/Example/None.
728 </descrip>
729 </quote>
730
731
732 <sect1>PEEKW<label id="PEEKW"><p>
733
734 <quote>
735 <descrip>
736 <tag/Function/Read a word (two bytes) from memory.
737 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
738 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
739 <tag/Description/The function will read the absolute memory given by <tt/addr/
740 and return the value read. The byte read from the higher address is the high
741 byte of the return value.
742 <tag/Limits/<itemize>
743 <item>The function is actually a macro.
744 <item>This function depends highly on the platform and environment.
745 <item>The order in which the two bytes are read is unspecified and may
746 depend of the address expression used.
747 </itemize>
748 <tag/Availability/cc65
749 <tag/See also/
750 <ref id="PEEK" name="PEEK">,
751 <ref id="POKE" name="POKE">
752 <tag/Example/None.
753 </descrip>
754 </quote>
755
756
757 <sect1>POKE<label id="POKE"><p>
758
759 <quote>
760 <descrip>
761 <tag/Function/Write a byte to memory.
762 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
763 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
764 <tag/Description/The function writes the value <tt/val/ to the absolute
765 memory address given by <tt/addr/.
766 <tag/Limits/<itemize>
767 <item>The function is actually a macro.
768 <item>This function depends highly on the platform and environment.
769 <item>Careless use will cause the program to act strange or may crash the
770 machine.
771 </itemize>
772 <tag/Availability/cc65
773 <tag/See also/
774 <ref id="PEEK" name="PEEK">,
775 <ref id="POKEW" name="POKEW">
776 <tag/Example/None.
777 </descrip>
778 </quote>
779
780
781 <sect1>POKEW<label id="POKEW"><p>
782
783 <quote>
784 <descrip>
785 <tag/Function/Write a word (two bytes) to memory.
786 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
787 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
788 <tag/Description/The function writes the value <tt/val/ to the absolute
789 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
790 the <tt/addr/, the high byte is written to <tt/addr+1/.
791 <tag/Limits/<itemize>
792 <item>The function is actually a macro.
793 <item>This function depends highly on the platform and environment.
794 <item>Careless use will cause the program to act strange or may crash the
795 machine.
796 <item>The order in which the two bytes are written is unspecified and may
797 depend of the address expression used.
798 </itemize>
799 <tag/Availability/cc65
800 <tag/See also/
801 <ref id="PEEK" name="PEEK">,
802 <ref id="POKE" name="POKE">
803 <tag/Example/None.
804 </descrip>
805 </quote>
806
807
808 <sect1>SEI<label id="SEI"><p>
809
810 <quote>
811 <descrip>
812 <tag/Function/Insert a 6502 SEI instrunction into the code.
813 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
814 <tag/Declaration/<tt/void SEI (void);/
815 <tag/Description/The function will insert a 6502 SEI instruction into the code,
816 so interrupts are enabled. Enabling interrupts has no effects if they are
817 already enabled (the default).
818 <tag/Limits/<itemize>
819 <item>The function is actually a macro.
820 </itemize>
821 <tag/Availability/cc65
822 <tag/See also/
823 <ref id="BRK" name="BRK">,
824 <ref id="CLI" name="CLI">
825 <tag/Example/None.
826 </descrip>
827 </quote>
828
829
830 <sect1>abort<label id="abort"><p>
831
832 <quote>
833 <descrip>
834 <tag/Function/Terminates a program abnormally.
835 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
836 <tag/Declaration/<tt/void abort (void);/
837 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
838 on stderr, then terminates the program with an exit code of 3.
839 <tag/Availability/ISO 9899
840 <tag/See also/
841 <ref id="assert" name="assert">,
842 <ref id="exit" name="exit">,
843 <ref id="raise" name="raise">
844 <tag/Example/None.
845 </descrip>
846 </quote>
847
848
849 <sect1>abs<label id="abs"><p>
850
851 <quote>
852 <descrip>
853 <tag/Function/Returns the absolute value of an integer.
854 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
855 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
856 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
857 the function.
858 <tag/Limits/<itemize>
859 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
860 <item>The function is only available as fastcall function, so it may only be
861 used in presence of a prototype.
862 </itemize>
863 <tag/Availability/ISO 9899
864 <tag/See also/
865 <ref id="labs" name="labs">
866 <tag/Example/None.
867 </descrip>
868 </quote>
869
870
871 <sect1>assert<label id="assert"><p>
872
873 <quote>
874 <descrip>
875 <tag/Function/Test a condition and possibly abort.
876 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
877 <tag/Declaration/<tt/void assert (int cond);/
878 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
879 statement. If the condition evaluates t zero (false), assert prints a message
880 on stderr and aborts the program.
881 <tag/Limits/<itemize>
882 <item>The function is actually a macro.
883 </itemize>
884 <tag/Availability/ISO 9899
885 <tag/See also/
886 <ref id="abort" name="abort">,
887 <ref id="exit" name="exit">
888 <tag/Example/None.
889 </descrip>
890 </quote>
891
892
893 <sect1>atexit<label id="atexit"><p>
894
895 <quote>
896 <descrip>
897 <tag/Function/Register an exit function.
898 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
899 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
900 <tag/Description/<tt/atexit/ registers the function pointed to by
901 <tt/exitfunc/ as an exit function. Exit functions are called when the program
902 terminates, they are called in LIFO order (the last function registered is
903 called first). <tt/atexit/ returns zero on success and a nonzero value on
904 failure.
905 <tag/Limits/<itemize>
906 <item>A maximum of 5 exit functions can be registered.
907 <item>There is no way to unregister an exit function.
908 <item>The function is only available as fastcall function, so it may only be
909 used in presence of a prototype.
910 </itemize>
911 <tag/Availability/ISO 9899
912 <tag/See also/
913 <ref id="abort" name="abort">,
914 <ref id="exit" name="exit">
915 <tag/Example/None.
916 </descrip>
917 </quote>
918
919
920 <sect1>atoi<label id="atoi"><p>
921
922 <quote>
923 <descrip>
924 <tag/Function/Convert a string to an integer.
925 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
926 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
927 <tag/Description/<tt/atoi/ converts the given string into an integer.
928 Conversion stops as soon as any invalid character is encountered.
929 <tag/Limits/<itemize>
930 <item>There is no way to detect any conversion errors.
931 <item>The function does not check for an numerical overflow when converting.
932 <item>The function is only available as fastcall function, so it may only be
933 used in presence of a prototype.
934 </itemize>
935 <tag/Availability/ISO 9899
936 <tag/See also/
937 <ref id="atol" name="atol">,
938 <ref id="itoa" name="itoa">,
939 <ref id="ltoa" name="ltoa">,
940 <ref id="ultoa" name="ultoa">,
941 <ref id="utoa" name="utoa">
942 <tag/Example/None.
943 </descrip>
944 </quote>
945
946
947 <sect1>atol<label id="atol"><p>
948
949 <quote>
950 <descrip>
951 <tag/Function/Convert a string to a long integer.
952 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
953 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
954 <tag/Description/<tt/atol/ converts the given string into a long integer.
955 Conversion stops as soon as any invalid character is encountered.
956 <tag/Limits/<itemize>
957 <item>There is no way to detect any conversion errors.
958 <item>The function does not check for an numerical overflow when converting.
959 <item>The function is only available as fastcall function, so it may only be
960 used in presence of a prototype.
961 </itemize>
962 <tag/Availability/ISO 9899
963 <tag/See also/
964 <ref id="atoi" name="atoi">,
965 <ref id="itoa" name="itoa">,
966 <ref id="ltoa" name="ltoa">,
967 <ref id="ultoa" name="ultoa">,
968 <ref id="utoa" name="utoa">
969 <tag/Example/None.
970 </descrip>
971 </quote>
972
973
974 <sect1>bgcolor<label id="bgcolor"><p>
975
976 <quote>
977 <descrip>
978 <tag/Function/Set the background text color.
979 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
980 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
981 <tag/Description/The function will set a new background color and return the
982 old (current) one. The background color is valid for the whole text output
983 area of the screen, not just for new text.
984 <tag/Limits/<itemize>
985 <item>Background colors are system dependent. The function may have no effect
986 on systems where the background color cannot be changed.
987 <item>The function is only available as fastcall function, so it may only be
988 used in presence of a prototype.
989 </itemize>
990 <tag/Availability/cc65
991 <tag/See also/
992 <ref id="bordercolor" name="bordercolor">,
993 <ref id="textcolor" name="textcolor">
994 <tag/Example/None.
995 </descrip>
996 </quote>
997
998
999 <sect1>bordercolor<label id="bordercolor"><p>
1000
1001 <quote>
1002 <descrip>
1003 <tag/Function/Set the border (frame) color.
1004 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1005 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1006 <tag/Description/The function will set a new border color. It returns the old
1007 (current) border color.
1008 <tag/Limits/<itemize>
1009 <item>Border colors are system dependent. The function may have no effect
1010 on systems where the border color cannot be changed.
1011 <item>The function is only available as fastcall function, so it may only
1012 be used in presence of a prototype.
1013 </itemize>
1014 <tag/Availability/cc65
1015 <tag/See also/
1016 <ref id="bgcolor" name="bgcolor">,
1017 <ref id="textcolor" name="textcolor">
1018 <tag/Example/None.
1019 </descrip>
1020 </quote>
1021
1022
1023 <sect1>bsearch<label id="bsearch"><p>
1024
1025 <quote>
1026 <descrip>
1027 <tag/Function/Do a binary search in a sorted array.
1028 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1029 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1030 const void* base, size_t n, size_t size,
1031 int (*cmp) (const void*, const void*));/
1032 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1033 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1034 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1035 the function used to compare the members against the key. The function returns
1036 a pointer to the member found, or <tt/NULL/ if there was no match.
1037 <tag/Limits/
1038 <itemize>
1039 <item>The contents of the array must be sorted in ascending order according to
1040 the compare function given.
1041 <item>If there are multiple members that match the key, the function will
1042 return one of the members.
1043 <item>The function is only available as fastcall function, so it may only
1044 be used in presence of a prototype.
1045 </itemize>
1046 <tag/Availability/ISO 9899
1047 <tag/See also/
1048 <ref id="qsort" name="qsort">
1049 <tag/Example/None.
1050 </descrip>
1051 </quote>
1052
1053
1054 <sect1>bzero<label id="bzero"><p>
1055
1056 <quote>
1057 <descrip>
1058 <tag/Function/Fill a memory area with zeroes.
1059 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1060 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1061 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1062 zero.
1063 <tag/Limits/
1064 <itemize>
1065 <item>The function is non standard and therefore only available in non ANSI
1066 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1067 <item>The function is only available as fastcall function, so it may only
1068 be used in presence of a prototype.
1069 </itemize>
1070 <tag/Availability/cc65
1071 <tag/See also/
1072 <ref id="_swap" name="_swap">,
1073 <ref id="memcpy" name="memcpy">,
1074 <ref id="memmove" name="memmove">,
1075 <ref id="memset" name="memset">,
1076 <tag/Example/None.
1077 </descrip>
1078 </quote>
1079
1080
1081 <sect1>c64mode<label id="c64mode"><p>
1082
1083 <quote>
1084 <descrip>
1085 <tag/Function/Switch the C128 into C64 compatible mode.
1086 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1087 <tag/Declaration/<tt/void c64mode (void);/
1088 <tag/Description/The function will cause the machine to reboot into C64 mode.
1089 <tag/Limits/<itemize>
1090 <item>The function is specific to the C128.
1091 <item>The function will not return to the caller.
1092 </itemize>
1093 <tag/Availability/C128
1094 <tag/Example/None.
1095 </descrip>
1096 </quote>
1097
1098
1099 <sect1>calloc<label id="calloc"><p>
1100
1101 <quote>
1102 <descrip>
1103 <tag/Function/Allocate and clear memory.
1104 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1105 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1106 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1107 of size <tt/size/, clears the whole block with binary zeroes and returns a
1108 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1109 <tt/NULL/.
1110 <tag/Limits/
1111 <itemize>
1112 <item>Clearing the memory may not have the expected effect on all platforms:
1113 pointers in the block may not be <tt/NULL/ and floating point variables may
1114 not be zero (0.0). In other words: The "clearing" effect of this function
1115 should be used with care for portable programs.
1116 <item>The function is only available as fastcall function, so it may only
1117 be used in presence of a prototype.
1118 </itemize>
1119 <tag/Availability/ISO 9899
1120 <tag/See also/
1121 <ref id="_heapadd" name="_heapadd">,
1122 <ref id="_heapblocksize" name="_heapblocksize">,
1123 <ref id="_heapmaxavail" name="_heapmaxavail">,
1124 <ref id="_heapmemavail" name="_heapmemavail">,
1125 <ref id="free" name="free">,
1126 <ref id="malloc" name="malloc">,
1127 <ref id="realloc" name="realloc">
1128 <tag/Example/None.
1129 </descrip>
1130 </quote>
1131
1132
1133 <sect1>cclear<label id="cclear"><p>
1134
1135 <quote>
1136 <descrip>
1137 <tag/Function/Clear part of a line (write a given number of spaces).
1138 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1139 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
1140 <tag/Description/The function clears part of a line by writing <tt/length/
1141 spaces in the current text color.
1142 <tag/Limits/<itemize>
1143 <item>The function is only available as fastcall function, so it may
1144 only be used in presence of a prototype.
1145 </itemize>
1146 <tag/Availability/cc65
1147 <tag/See also/
1148 <ref id="cclearxy" name="cclearxy">,
1149 <ref id="clrscr" name="clrscr">
1150 <tag/Example/None.
1151 </descrip>
1152 </quote>
1153
1154
1155 <sect1>cclearxy<label id="cclearxy"><p>
1156
1157 <quote>
1158 <descrip>
1159 <tag/Function/Clear part of a line (write a given number of spaces) starting
1160 at a specific screen position.
1161 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1162 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
1163 <tag/Description/The function moves the cursor to a specific position, and
1164 will then clear part of the line by writing <tt/length/ spaces in the current
1165 text color.
1166 <tag/Limits/<itemize>
1167 <item>The function is only available as fastcall function, so it may
1168 only be used in presence of a prototype.
1169 </itemize>
1170 <tag/Availability/cc65
1171 <tag/See also/
1172 <ref id="cclear" name="cclear">,
1173 <ref id="clrscr" name="clrscr">
1174 <tag/Example/None.
1175 </descrip>
1176 </quote>
1177
1178
1179 <sect1>cgetc<label id="cgetc"><p>
1180
1181 <quote>
1182 <descrip>
1183 <tag/Function/Read a character from the keyboard.
1184 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1185 <tag/Declaration/<tt/char cgetc (void);/
1186 <tag/Description/The function reads a character from the keyboard. If there is
1187 no character available, <tt/cgetc/ waits until the user presses a key. If the
1188 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1189 displayed while waiting.
1190 <tag/Limits/<itemize>
1191 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1192 from this buffer and wait only if the buffer is empty.
1193 </itemize>
1194 <tag/Availability/cc65
1195 <tag/See also/
1196 <ref id="cursor" name="cursor">,
1197 <ref id="kbhit" name="kbhit">
1198 <tag/Example/None.
1199 </descrip>
1200 </quote>
1201
1202
1203 <sect1>chline<label id="chline"><p>
1204
1205 <quote>
1206 <descrip>
1207 <tag/Function/Output a horizontal line in text mode.
1208 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1209 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1210 <tag/Description/The function outputs a horizontal line with the given length
1211 starting at the current cursor position.
1212 <tag/Limits/<itemize>
1213 <item>The character used to draw the horizontal line is system dependent.
1214 If available, a line drawing character is used. Drawing a line that is partially
1215 off screen leads to undefined behaviour.
1216 <item>The function is only available as fastcall function, so it may only be
1217 used in presence of a prototype.
1218 </itemize>
1219 <tag/Availability/cc65
1220 <tag/See also/
1221 <ref id="chlinexy" name="chlinexy">,
1222 <ref id="cvline" name="cvline">,
1223 <ref id="cvlinexy" name="cvlinexy">
1224 <tag/Example/None.
1225 </descrip>
1226 </quote>
1227
1228
1229 <sect1>chlinexy<label id="chlinexy"><p>
1230
1231 <quote>
1232 <descrip>
1233 <tag/Function/Output a horizontal line at a given position in text mode.
1234 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1235 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1236 <tag/Description/The function outputs a horizontal line with the given length
1237 starting at a given position.
1238 <tag/Limits/<itemize>
1239 <item>The character used to draw the horizontal line is system dependent.
1240 If available, a line drawing character is used. Drawing a line that is partially
1241 off screen leads to undefined behaviour.
1242 <item>The function is only available as fastcall function, so it may only be
1243 used in presence of a prototype.
1244 </itemize>
1245 <tag/Availability/cc65
1246 <tag/See also/
1247 <ref id="chline" name="chline">,
1248 <ref id="cvline" name="cvline">,
1249 <ref id="cvlinexy" name="cvlinexy">
1250 <tag/Example/None.
1251 </descrip>
1252 </quote>
1253
1254
1255 <sect1>clearerr<label id="clearerr"><p>
1256
1257 <quote>
1258 <descrip>
1259 <tag/Function/Clear error and end-of-file status of a stream.
1260 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1261 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
1262 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
1263 indicators for the stream <tt/f/.
1264 <tag/Limits/<itemize>
1265 <item>The function is only available as fastcall function, so it may only be
1266 used in presence of a prototype.
1267 </itemize>
1268 <tag/Availability/ISO 9899
1269 <tag/See also/
1270 <ref id="feof" name="feof">,
1271 <ref id="ferror" name="ferror">
1272 <tag/Example/None.
1273 </descrip>
1274 </quote>
1275
1276
1277 <sect1>clrscr<label id="clrscr"><p>
1278
1279 <quote>
1280 <descrip>
1281 <tag/Function/Clear the text screen.
1282 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1283 <tag/Declaration/<tt/void clrscr (void);/
1284 <tag/Description/The function clears the text screen and moves the cursor to
1285 the upper left corner.
1286 <tag/Availability/cc65
1287 <tag/See also/
1288 <ref id="cclear" name="cclear">,
1289 <ref id="cclearxy" name="cclearxy">
1290 <tag/Example/None.
1291 </descrip>
1292 </quote>
1293
1294
1295 <sect1>close<label id="close"><p>
1296
1297 <quote>
1298 <descrip>
1299 <tag/Function/Close a file descriptor.
1300 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1301 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1302 <tag/Description/The function closes the given file descriptor. It returns zero
1303 on success and -1 on error. If an error occurs, the cause can be determined by
1304 reading the <tt/errno/ variable.
1305 <tag/Limits/<itemize>
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/POSIX 1003.1
1310 <tag/See also/
1311 <ref id="creat" name="creat">,
1312 <ref id="open" name="open">
1313 <tag/Example/None.
1314 </descrip>
1315 </quote>
1316
1317
1318 <sect1>creat<label id="creat"><p>
1319
1320 <quote>
1321 <descrip>
1322 <tag/Function/Create a file.
1323 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1324 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1325 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1326 associated with it. On error, -1 is returned and an error code is stored in
1327 <tt/errno/.
1328 <tag/Limits/<itemize>
1329 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1330 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1331 <item>The function is only available as fastcall function, so it may only
1332 be used in presence of a prototype.
1333 </itemize>
1334 <tag/Availability/POSIX 1003.1
1335 <tag/See also/
1336 <ref id="close" name="close">,
1337 <ref id="open" name="open">
1338 <tag/Example/None.
1339 </descrip>
1340 </quote>
1341
1342
1343 <sect1>cprintf<label id="cprintf"><p>
1344
1345 <quote>
1346 <descrip>
1347 <tag/Function/Formatted output to the console.
1348 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1349 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
1350 <tag/Description/The arguments are converted to text where necessary and
1351 formatted according to the format string given. The resulting string is output
1352 to the console. <tt/cprintf/ supports the same format specifiers as
1353 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
1354 <tag/Limits/<itemize>
1355 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
1356 between <tt/\r/ and <tt/\n/.
1357 </itemize>
1358 <tag/Availability/cc65
1359 <tag/See also/
1360 <ref id="cputc" name="cputc">,
1361 <ref id="cputcxy" name="cputcxy">,
1362 <ref id="cputs" name="cputs">,
1363 <ref id="cputsxy" name="cputsxy">,
1364 <ref id="vcprintf" name="vcprintf">
1365 <tag/Example/None.
1366 </descrip>
1367 </quote>
1368
1369
1370 <sect1>cputc<label id="cputc"><p>
1371
1372 <quote>
1373 <descrip>
1374 <tag/Function/Output a character directly to the console.
1375 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1376 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
1377 <tag/Description/Output one character to the console at the current cursor
1378 position.
1379 <tag/Limits/<itemize>
1380 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
1381 between <tt/\r/ and <tt/\n/.
1382 <item>The function is only available as fastcall function, so it may only
1383 be used in presence of a prototype.
1384 </itemize>
1385 <tag/Availability/cc65
1386 <tag/See also/
1387 <ref id="cprintf" name="cprintf">,
1388 <ref id="cputcxy" name="cputcxy">,
1389 <ref id="cputs" name="cputs">,
1390 <ref id="cputsxy" name="cputsxy">,
1391 <ref id="vcprintf" name="vcprintf">
1392 <tag/Example/None.
1393 </descrip>
1394 </quote>
1395
1396
1397 <sect1>cputcxy<label id="cputcxy"><p>
1398
1399 <quote>
1400 <descrip>
1401 <tag/Function/Output a character at a specific screen position.
1402 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1403 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
1404 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
1405 the screen and outputs one character.
1406 <tag/Limits/<itemize>
1407 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
1408 between <tt/\r/ and <tt/\n/.
1409 <item>The function is only available as fastcall function, so it may only
1410 be used in presence of a prototype.
1411 </itemize>
1412 <tag/Availability/cc65
1413 <tag/See also/
1414 <ref id="cprintf" name="cprintf">,
1415 <ref id="cputc" name="cputc">,
1416 <ref id="cputs" name="cputs">,
1417 <ref id="cputsxy" name="cputsxy">,
1418 <ref id="vcprintf" name="vcprintf">
1419 <tag/Example/None.
1420 </descrip>
1421 </quote>
1422
1423
1424 <sect1>cputs<label id="cputs"><p>
1425
1426 <quote>
1427 <descrip>
1428 <tag/Function/Output a string directly to the console.
1429 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1430 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
1431 <tag/Description/The function outputs the given string on the console at the
1432 current cursor position.
1433 <tag/Limits/<itemize>
1434 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
1435 between <tt/\r/ and <tt/\n/.
1436 <item>The function is only available as fastcall function, so it may only
1437 be used in presence of a prototype.
1438 </itemize>
1439 <tag/Availability/cc65
1440 <tag/See also/
1441 <ref id="cprintf" name="cprintf">,
1442 <ref id="cputc" name="cputc">,
1443 <ref id="cputcxy" name="cputcxy">,
1444 <ref id="cputsxy" name="cputsxy">,
1445 <ref id="vcprintf" name="vcprintf">
1446 <tag/Example/None.
1447 </descrip>
1448 </quote>
1449
1450
1451 <sect1>cputsxy<label id="cputsxy"><p>
1452
1453 <quote>
1454 <descrip>
1455 <tag/Function/Output a string to the console at a given position.
1456 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1457 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
1458 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
1459 and outputs the string <tt/s/.
1460 <tag/Limits/<itemize>
1461 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
1462 between <tt/\r/ and <tt/\n/.
1463 <item>The function is only available as fastcall function, so it may only
1464 be used in presence of a prototype.
1465 </itemize>
1466 <tag/Availability/cc65
1467 <tag/See also/
1468 <ref id="cprintf" name="cprintf">,
1469 <ref id="cputc" name="cputc">,
1470 <ref id="cputcxy" name="cputcxy">,
1471 <ref id="cputs" name="cputs">,
1472 <ref id="vcprintf" name="vcprintf">
1473 <tag/Example/None.
1474 </descrip>
1475 </quote>
1476
1477
1478 <sect1>cursor<label id="cursor"><p>
1479
1480 <quote>
1481 <descrip>
1482 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1483 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1484 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1485 <tag/Description/If the argument to the function is non zero, a blinking cursor
1486 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1487 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1488 <tag/Limits/<itemize>
1489 <item>The function is only available as fastcall function, so it may only
1490 be used in presence of a prototype.
1491 </itemize>
1492 <tag/Availability/cc65
1493 <tag/See also/
1494 <ref id="cgetc" name="cgetc">,
1495 <ref id="kbhit" name="kbhit">
1496 <tag/Example/None.
1497 </descrip>
1498 </quote>
1499
1500
1501 <sect1>cvline<label id="cvline"><p>
1502
1503 <quote>
1504 <descrip>
1505 <tag/Function/Output a vertical line in text mode.
1506 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1507 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1508 <tag/Description/The function outputs a vertical line with the given length
1509 starting at the current cursor position.
1510 <tag/Limits/<itemize>
1511 <item>The character used to draw the vertical line is system dependent.
1512 If available, a line drawing character is used. Drawing a line that is partially
1513 off screen leads to undefined behaviour.
1514 <item>The function is only available as fastcall function, so it may only be
1515 used in presence of a prototype.
1516 </itemize>
1517 <tag/Availability/cc65
1518 <tag/See also/
1519 <ref id="chline" name="chline">,
1520 <ref id="chlinexy" name="chlinexy">,
1521 <ref id="cvlinexy" name="cvlinexy">
1522 <tag/Example/None.
1523 </descrip>
1524 </quote>
1525
1526
1527 <sect1>cvlinexy<label id="cvlinexy"><p>
1528
1529 <quote>
1530 <descrip>
1531 <tag/Function/Output a vertical line at a given position in text mode.
1532 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1533 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1534 <tag/Description/The function outputs a vertical line with the given length
1535 starting at a given position.
1536 <tag/Limits/<itemize>
1537 <item>The character used to draw the vertical line is system dependent.
1538 If available, a line drawing character is used. Drawing a line that is partially
1539 off screen leads to undefined behaviour.
1540 <item>The function is only available as fastcall function, so it may only be
1541 used in presence of a prototype.
1542 </itemize>
1543 <tag/Availability/cc65
1544 <tag/See also/
1545 <ref id="chline" name="chline">,
1546 <ref id="chlinexy" name="chlinexy">,
1547 <ref id="cvline" name="cvline">
1548 <tag/Example/None.
1549 </descrip>
1550 </quote>
1551
1552
1553 <sect1>div<label id="div"><p>
1554
1555 <quote>
1556 <descrip>
1557 <tag/Function/Divide two ints and return quotient and remainder.
1558 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1559 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1560 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1561 quotient and remainder in a <tt/div_t/ structure.
1562 <tag/Limits/
1563 <itemize>
1564 <item>The function is only available as fastcall function, so it may only
1565 be used in presence of a prototype.
1566 </itemize>
1567 <tag/Availability/ISO 9899
1568 <tag/See also/
1569 ldiv
1570 <tag/Example/None.
1571 </descrip>
1572 </quote>
1573
1574
1575 <sect1>em_commit<label id="em_commit"><p>
1576
1577 <quote>
1578 <descrip>
1579 <tag/Function/Commit changes into extended memory.
1580 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1581 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1582 <tag/Description/Commit changes in the memory window to extended storage. If
1583 the contents of the memory window have been changed, these changes may be lost
1584 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1585 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1586 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1587 <tag/Limits/<itemize>
1588 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1589 memory window are discarded, it does just mean that the drivers is allowed
1590 to discard it.
1591 <item>The function is only available as fastcall function, so it may only be
1592 used in presence of a prototype.
1593 <item>The function produces undefined results if no extended memory driver is
1594 loaded.
1595 </itemize>
1596 <tag/Availability/cc65
1597 <tag/See also/
1598 <ref id="em_load_driver" name="em_load_driver">,
1599 <ref id="em_map" name="em_map">,
1600 <ref id="em_use" name="em_use">
1601 <tag/Example/None.
1602 </descrip>
1603 </quote>
1604
1605
1606 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1607
1608 <quote>
1609 <descrip>
1610 <tag/Function/Copy from extended into normal memory.
1611 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1612 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1613 <tag/Description/Copy data from extended memory into linear memory. Source and
1614 target addresses as well as the number of bytes to transfer are specified in
1615 the <tt/em_copy/ structure that is passed as a parameter.
1616 <tag/Limits/<itemize>
1617 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1618 made any changes to the data in the window, call <tt/<ref id="em_commit"
1619 name="em_commit">/ first, or the changes are lost.
1620 <item>The function is only available as fastcall function, so it may only be
1621 used in presence of a prototype.
1622 <item>The function produces undefined results if no extended memory driver is
1623 loaded.
1624 </itemize>
1625 <tag/Availability/cc65
1626 <tag/See also/
1627 <ref id="em_commit" name="em_commit">,
1628 <ref id="em_copyto" name="em_copyto">,
1629 <ref id="em_load_driver" name="em_load_driver">
1630 <tag/Example/None.
1631 </descrip>
1632 </quote>
1633
1634
1635 <sect1>em_copyto<label id="em_copyto"><p>
1636
1637 <quote>
1638 <descrip>
1639 <tag/Function/Copy from normal into extended memory.
1640 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1641 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1642 <tag/Description/Copy data from linear into extended memory. Source and
1643 target addresses as well as the number of bytes to transfer are specified in
1644 the <tt/em_copy/ structure that is passed as a parameter.
1645 <tag/Limits/<itemize>
1646 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1647 made any changes to the data in the window, call <tt/<ref id="em_commit"
1648 name="em_commit">/ first, or the changes are lost.
1649 <item>The function is only available as fastcall function, so it may only be
1650 used in presence of a prototype.
1651 <item>The function produces undefined results if no extended memory driver is
1652 loaded.
1653 </itemize>
1654 <tag/Availability/cc65
1655 <tag/See also/
1656 <ref id="em_commit" name="em_commit">,
1657 <ref id="em_copyfrom" name="em_copyfrom">,
1658 <ref id="em_load_driver" name="em_load_driver">
1659 <tag/Example/None.
1660 </descrip>
1661 </quote>
1662
1663
1664 <sect1>em_load_driver<label id="em_load_driver"><p>
1665
1666 <quote>
1667 <descrip>
1668 <tag/Function/Load and initialize an extended memory driver.
1669 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1670 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1671 <tag/Description/Load an extended memory driver into memory and initialize
1672 it. The function returns an error code that tells if all this has been
1673 successful.
1674 <tag/Limits/<itemize>
1675 <item>Not all drivers are able to detect if the supported hardware is really
1676 present.
1677 <item>The function is only available as fastcall function, so it may only be
1678 used in presence of a prototype.
1679 <item>The driver is loaded by name, so currently you must know the type of
1680 extended memory that should be supported. There is no autodetect capability.
1681 </itemize>
1682 <tag/Availability/cc65
1683 <tag/See also/
1684 <ref id="em_unload" name="em_unload">
1685 <tag/Example/None.
1686 </descrip>
1687 </quote>
1688
1689
1690 <sect1>em_map<label id="em_map"><p>
1691
1692 <quote>
1693 <descrip>
1694 <tag/Function/Make a page of extended memory accessible.
1695 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1696 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1697 <tag/Description/The function maps one page of extended memory into linear
1698 memory and returns a pointer to the page frame. Depending on the hardware
1699 and driver, the data is either mapped into the address space or transfered
1700 into a buffer. If you don't need the actual contents of the page (for example
1701 because you're going to overwrite it completely, it is better to call
1702 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1703 data if it is possible to avoid that.
1704 <tag/Limits/<itemize>
1705 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1706 made any changes to the data in the window, call <tt/<ref id="em_commit"
1707 name="em_commit">/ first, or the changes are lost.
1708 <item>The function is only available as fastcall function, so it may only be
1709 used in presence of a prototype.
1710 <item>The function produces undefined results if no extended memory driver is
1711 loaded.
1712 </itemize>
1713 <tag/Availability/cc65
1714 <tag/See also/
1715 <ref id="em_commit" name="em_commit">,
1716 <ref id="em_load_driver" name="em_load_driver">,
1717 <ref id="em_use" name="em_use">
1718 <tag/Example/None.
1719 </descrip>
1720 </quote>
1721
1722
1723 <sect1>em_pagecount<label id="em_pagecount"><p>
1724
1725 <quote>
1726 <descrip>
1727 <tag/Function/Return the number of available extended memory pages.
1728 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1729 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1730 <tag/Description/The function returns the size of the extended memory supported
1731 by the driver in 256 byte pages.
1732 <tag/Limits/<itemize>
1733 <item>The function returns zero if no extended memory driver is loaded.
1734 <item>The function may return zero if the supported hardware was not detected.
1735 </itemize>
1736 <tag/Availability/cc65
1737 <tag/See also/
1738 <ref id="em_load_driver" name="em_load_driver">
1739 <tag/Example/None.
1740 </descrip>
1741 </quote>
1742
1743
1744 <sect1>em_unload<label id="em_unload"><p>
1745
1746 <quote>
1747 <descrip>
1748 <tag/Function/Unload an extended memory driver.
1749 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1750 <tag/Declaration/<tt/void __fastcall__ em_unload (void);/
1751 <tag/Description/The function unloads a loaded extended memory driver and
1752 frees all memory allocated for the driver.
1753 <tag/Limits/<itemize>
1754 <item>The function does nothing if no driver is loaded.
1755 </itemize>
1756 <tag/Availability/cc65
1757 <tag/See also/
1758 <ref id="em_load_driver" name="em_load_driver">
1759 <tag/Example/None.
1760 </descrip>
1761 </quote>
1762
1763
1764 <sect1>em_use<label id="em_use"><p>
1765
1766 <quote>
1767 <descrip>
1768 <tag/Function/Prepare an extended memory page for use.
1769 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1770 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1771 <tag/Description/The function maps one page of extended memory into linear
1772 memory and returns a pointer to the page frame. This function is similar to
1773 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1774 actual memory window in the assumption that the existing data is wrong or
1775 will get overwritten.
1776 <tag/Limits/<itemize>
1777 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1778 made any changes to the data in the window, call <tt/<ref id="em_commit"
1779 name="em_commit">/ first, or the changes are lost.
1780 <item>The function is only available as fastcall function, so it may only be
1781 used in presence of a prototype.
1782 <item>The function produces undefined results if no extended memory driver is
1783 loaded.
1784 </itemize>
1785 <tag/Availability/cc65
1786 <tag/See also/
1787 <ref id="em_commit" name="em_commit">,
1788 <ref id="em_load_driver" name="em_load_driver">,
1789 <ref id="em_map" name="em_map">
1790 <tag/Example/None.
1791 </descrip>
1792 </quote>
1793
1794
1795 <sect1>exit<label id="exit"><p>
1796
1797 <quote>
1798 <descrip>
1799 <tag/Function/Terminate the program.
1800 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1801 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1802 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1803 return code of the program. Before termination, all files are closed, buffered
1804 output is written and any functions registered with <tt/<ref id="atexit"
1805 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1806 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1807 name="stdlib.h">/.
1808 <tag/Limits/<itemize>
1809 <item>The function is only available as fastcall function, so it may only
1810 be used in presence of a prototype.
1811 <item>It depends on the host machine if the program return code can be
1812 evaluated or is ignored.
1813 </itemize>
1814 <tag/Availability/ISO 9899
1815 <tag/See also/
1816 <ref id="abort" name="abort">,
1817 <ref id="exit" name="exit">
1818 <tag/Example/None.
1819 </descrip>
1820 </quote>
1821
1822
1823 <sect1>fast<label id="fast"><p>
1824
1825 <quote>
1826 <descrip>
1827 <tag/Function/Switch the C128 into 2MHz mode.
1828 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1829 <tag/Declaration/<tt/void fast (void);/
1830 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
1831 will nearly double the speed compared to slow mode.
1832 <tag/Limits/<itemize>
1833 <item>The function is specific to the C128.
1834 <item>2MHz clock will not work in 40 column mode.
1835 </itemize>
1836 <tag/Availability/C128
1837 <tag/See also/
1838 <ref id="slow" name="slow">,
1839 <ref id="toggle_videomode" name="toggle_videomode">
1840 <tag/Example/None.
1841 </descrip>
1842 </quote>
1843
1844
1845 <sect1>feof<label id="feof"><p>
1846
1847 <quote>
1848 <descrip>
1849 <tag/Function/Return the end-of-file indicator of a stream.
1850 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1851 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
1852 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
1853 <tt/f/, and returns a non zero value if it is set.
1854 <tag/Limits/<itemize>
1855 <item>The indicator is set only after a read past the end of a file is
1856 attempted.
1857 <item>The function is only available as fastcall function, so it may only be
1858 used in presence of a prototype.
1859 </itemize>
1860 <tag/Availability/ISO 9899
1861 <tag/See also/
1862 <ref id="feof" name="clearerr">,
1863 <ref id="ferror" name="ferror">
1864 <tag/Example/None.
1865 </descrip>
1866 </quote>
1867
1868
1869 <sect1>ferror<label id="ferror"><p>
1870
1871 <quote>
1872 <descrip>
1873 <tag/Function/Return the error indicator of a stream.
1874 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1875 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
1876 <tag/Description/<tt/ferror/ tests the error indicator of the stream
1877 <tt/f/, and returns a non zero value if it is set.
1878 <tag/Limits/<itemize>
1879 <item>The function is only available as fastcall function, so it may only be
1880 used in presence of a prototype.
1881 </itemize>
1882 <tag/Availability/ISO 9899
1883 <tag/See also/
1884 <ref id="feof" name="clearerr">,
1885 <ref id="ferror" name="feof">
1886 <tag/Example/None.
1887 </descrip>
1888 </quote>
1889
1890
1891 <sect1>fileno<label id="fileno"><p>
1892
1893 <quote>
1894 <descrip>
1895 <tag/Function/Return the file handle used by a stream.
1896 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1897 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
1898 <tag/Description/The <tt/fileno/ function returns the file handle used
1899 internally by a C stream. This file handle (an integer) can be used as a
1900 handle for the POSIX input/output functions.
1901 <tag/Limits/<itemize>
1902 <item>The function is only available as fastcall function, so it may only be
1903 used in presence of a prototype.
1904 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
1905 file may have unpredictable results.
1906 </itemize>
1907 <tag/Availability/POSIX 1003.1
1908 <tag/See also/
1909 <ref id="creat" name="creat">,
1910 <ref id="open" name="open"> <!-- , -->
1911 <!-- <ref id="read" name="read">, -->
1912 <!-- <ref id="write" name="write"> -->
1913 <tag/Example/None.
1914 </descrip>
1915 </quote>
1916
1917
1918 <sect1>free<label id="free"><p>
1919
1920 <quote>
1921 <descrip>
1922 <tag/Function/Free a block of dynamic memory.
1923 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1924 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
1925 <tag/Description/Free a block of dynamic memory previously allocated with
1926 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
1927 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
1928 pointer is <tt/NULL/, no action is performed.
1929 <tag/Limits/
1930 <itemize>
1931 <item>Passing an already free'd block to <tt/free/ again will cause undefined
1932 behaviour and may crash your program.
1933 <item>The function is only available as fastcall function, so it may only
1934 be used in presence of a prototype.
1935 </itemize>
1936 <tag/Availability/ISO 9899
1937 <tag/See also/
1938 <ref id="_heapadd" name="_heapadd">,
1939 <ref id="_heapblocksize" name="_heapblocksize">,
1940 <ref id="_heapmaxavail" name="_heapmaxavail">,
1941 <ref id="_heapmemavail" name="_heapmemavail">,
1942 <ref id="calloc" name="calloc">,
1943 <ref id="malloc" name="malloc">,
1944 <ref id="realloc" name="realloc">
1945 <tag/Example/None.
1946 </descrip>
1947 </quote>
1948
1949
1950 <sect1>getenv<label id="getenv"><p>
1951
1952 <quote>
1953 <descrip>
1954 <tag/Function/Return a value from the environment.
1955 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1956 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
1957 <tag/Description/The function searches the environment for an entry that
1958 matches <tt/name/ and returns its value. The environment consists of a list
1959 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
1960 returns <tt/NULL/.
1961 <tag/Limits/<itemize>
1962 <item>What exactly is stored in the environment depends on the machine the
1963 program is running on.
1964 <item>The function is only available as fastcall function, so it may only
1965 be used in presence of a prototype.
1966 </itemize>
1967 <tag/Availability/ISO 9899
1968 <tag/Example/None.
1969 </descrip>
1970 </quote>
1971
1972
1973 <sect1>getcpu<label id="getcpu"><p>
1974
1975 <quote>
1976 <descrip>
1977 <tag/Function/Determine on which CPU the program is running.
1978 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1979 <tag/Declaration/<tt/unsigned char getcpu (void);/
1980 <tag/Description/The function checks on which CPU the code is running. It
1981 returns one of the constants<itemize>
1982 <item><tt/CPU_6502/
1983 <item><tt/CPU_65C02/
1984 <item><tt/CPU_65816/
1985 </itemize>
1986 <tag/Limits/<itemize>
1987 <item>Other, more exotic CPU types are not disinguished.
1988 </itemize>
1989 <tag/Availability/cc65
1990 <tag/Example/None.
1991 </descrip>
1992 </quote>
1993
1994
1995 <sect1>gotox<label id="gotox"><p>
1996
1997 <quote>
1998 <descrip>
1999 <tag/Function/Move the text mode cursor to a new X position.
2000 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2001 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
2002 <tag/Description/The function moves the text mode cursor to the specified X
2003 position while leaving the Y position untouched. The leftmost position on the
2004 screen has the coordinate 0.
2005 <tag/Limits/<itemize>
2006 <item>The function is only available as fastcall function, so it may
2007 only be used in presence of a prototype.
2008 <item>Invalid values for the X position (out of screen coordinates) may
2009 lead to undefined behaviour.
2010 </itemize>
2011 <tag/Availability/cc65
2012 <tag/See also/
2013 <ref id="gotoy" name="gotoy">,
2014 <ref id="gotoxy" name="gotoxy">,
2015 <ref id="wherex" name="wherex">,
2016 <ref id="wherey" name="wherey">
2017 <tag/Example/None.
2018 </descrip>
2019 </quote>
2020
2021
2022 <sect1>gotoxy<label id="gotoxy"><p>
2023
2024 <quote>
2025 <descrip>
2026 <tag/Function/Move the text mode cursor to a new position.
2027 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2028 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
2029 <tag/Description/The function moves the text mode cursor to the specified
2030 position. The leftmost position on the screen has the X coordinate 0, the
2031 topmost line has the Y coordinate 0.
2032 <tag/Limits/<itemize>
2033 <item>The function is only available as fastcall function, so it may only be
2034 used in presence of a prototype.
2035 <item>Invalid values for any of both coordinates (out of screen positions) may
2036 lead to undefined behaviour.
2037 </itemize>
2038 <tag/Availability/cc65
2039 <tag/See also/
2040 <ref id="gotox" name="gotox">,
2041 <ref id="gotoy" name="gotoy">,
2042 <ref id="wherex" name="wherex">,
2043 <ref id="wherey" name="wherey">
2044 <tag/Example/None.
2045 </descrip>
2046 </quote>
2047
2048
2049 <sect1>gotoy<label id="gotoy"><p>
2050
2051 <quote>
2052 <descrip>
2053 <tag/Function/Move the text mode cursor to a new Y position.
2054 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2055 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
2056 <tag/Description/The function moves the text mode cursor to the specified Y
2057 position while leaving the X position untouched. The uppermost position on the
2058 screen has the coordinate 0.
2059 <tag/Limits/<itemize>
2060 <item>The function is only available as fastcall function, so it may
2061 only be used in presence of a prototype.
2062 <item>Invalid values for the Y position (out of screen coordinates) may lead
2063 to undefined behaviour.
2064 </itemize>
2065 <tag/Availability/cc65
2066 <tag/See also/
2067 <ref id="gotox" name="gotox">,
2068 <ref id="gotoxy" name="gotoxy">,
2069 <ref id="wherex" name="wherex">,
2070 <ref id="wherey" name="wherey">
2071 <tag/Example/None.
2072 </descrip>
2073 </quote>
2074
2075
2076 <sect1>isalnum<label id="isalnum"><p>
2077
2078 <quote>
2079 <descrip>
2080 <tag/Function/Check if a given character is a letter or digit.
2081 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2082 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
2083 <tag/Description/The function returns a value of zero if the given argument
2084 is a letter or digit. The return value is non zero if the character
2085 is anything else.
2086 <tag/Limits/<itemize>
2087 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2088 inline sequence generated by the macro will not work correctly for values
2089 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2090 this range. The non inline function may be accessed by <tt/#undef/'ing
2091 the macro.
2092 <item>When compiling without <tt/-Os/, the function is only available as
2093 fastcall function, so it may only be used in presence of a prototype.
2094 </itemize>
2095 <tag/Availability/ISO 9899
2096 <tag/See also/
2097 <ref id="isalpha" name="isalpha">,
2098 <ref id="isascii" name="isascii">,
2099 <ref id="isblank" name="isblank">,
2100 <ref id="iscntrl" name="iscntrl">,
2101 <ref id="isdigit" name="isdigit">,
2102 <ref id="isgraph" name="isgraph">,
2103 <ref id="islower" name="islower">,
2104 <ref id="isprint" name="isprint">,
2105 <ref id="ispunct" name="ispunct">,
2106 <ref id="isspace" name="isspace">,
2107 <ref id="isupper" name="isupper">,
2108 <ref id="isxdigit" name="isxdigit">
2109 <tag/Example/None.
2110 </descrip>
2111 </quote>
2112
2113
2114 <sect1>isalpha<label id="isalpha"><p>
2115
2116 <quote>
2117 <descrip>
2118 <tag/Function/Check if a given character is a letter.
2119 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2120 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
2121 <tag/Description/The function returns a value of zero if the given argument
2122 is a letter. The return value is non zero if the character is anything else.
2123 <tag/Limits/<itemize>
2124 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2125 inline sequence generated by the macro will not work correctly for values
2126 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2127 this range. The non inline function may be accessed by <tt/#undef/'ing the
2128 macro.
2129 <item>When compiling without <tt/-Os/, the function is only available as
2130 fastcall function, so it may only be used in presence of a prototype.
2131 </itemize>
2132 <tag/Availability/ISO 9899
2133 <tag/See also/
2134 <ref id="isalnum" name="isalnum">,
2135 <ref id="isascii" name="isascii">,
2136 <ref id="isblank" name="isblank">,
2137 <ref id="iscntrl" name="iscntrl">,
2138 <ref id="isdigit" name="isdigit">,
2139 <ref id="isgraph" name="isgraph">,
2140 <ref id="islower" name="islower">,
2141 <ref id="isprint" name="isprint">,
2142 <ref id="ispunct" name="ispunct">,
2143 <ref id="isspace" name="isspace">,
2144 <ref id="isupper" name="isupper">,
2145 <ref id="isxdigit" name="isxdigit">
2146 <tag/Example/None.
2147 </descrip>
2148 </quote>
2149
2150
2151 <sect1>isascii<label id="isascii"><p>
2152
2153 <quote>
2154 <descrip>
2155 <tag/Function/Check if a given character is in the ASCII (0..127) range.
2156 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2157 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
2158 <tag/Description/The function returns a value of zero if the given argument
2159 is in the range 0..127 (the range of valid ASCII characters) and a non zero
2160 value if not.
2161 <tag/Limits/<itemize>
2162 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2163 inline sequence generated by the macro will not work correctly for values
2164 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2165 this range. The non inline function may be accessed by <tt/#undef/'ing the
2166 macro.
2167 <item>When compiling without <tt/-Os/, the function is only available as
2168 fastcall function, so it may only be used in presence of a prototype.
2169 </itemize>
2170 <tag/Availability/ISO 9899
2171 <tag/See also/
2172 <ref id="isalnum" name="isalnum">,
2173 <ref id="isalpha" name="isalpha">,
2174 <ref id="isblank" name="isblank">,
2175 <ref id="iscntrl" name="iscntrl">,
2176 <ref id="isdigit" name="isdigit">,
2177 <ref id="isgraph" name="isgraph">,
2178 <ref id="islower" name="islower">,
2179 <ref id="isprint" name="isprint">,
2180 <ref id="ispunct" name="ispunct">,
2181 <ref id="isspace" name="isspace">,
2182 <ref id="isupper" name="isupper">,
2183 <ref id="isxdigit" name="isxdigit">
2184 <tag/Example/None.
2185 </descrip>
2186 </quote>
2187
2188
2189 <sect1>isblank<label id="isblank"><p>
2190
2191 <quote>
2192 <descrip>
2193 <tag/Function/Check if a given character is a space or tab.
2194 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2195 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
2196 <tag/Description/The function returns a value of zero if the given argument
2197 is a space or tab character. The return value is non zero if the character
2198 is anything else.
2199 <tag/Limits/<itemize>
2200 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2201 inline sequence generated by the macro will not work correctly for values
2202 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2203 this range. The non inline function may be accessed by <tt/#undef/'ing the
2204 macro.
2205 <item>When compiling without <tt/-Os/, the function is only available as
2206 fastcall function, so it may only be used in presence of a prototype.
2207 </itemize>
2208 <tag/Availability/cc65
2209 <tag/See also/
2210 <ref id="isalnum" name="isalnum">,
2211 <ref id="isalpha" name="isalpha">,
2212 <ref id="isascii" name="isascii">,
2213 <ref id="iscntrl" name="iscntrl">,
2214 <ref id="isdigit" name="isdigit">,
2215 <ref id="isgraph" name="isgraph">,
2216 <ref id="islower" name="islower">,
2217 <ref id="isprint" name="isprint">,
2218 <ref id="ispunct" name="ispunct">,
2219 <ref id="isspace" name="isspace">,
2220 <ref id="isupper" name="isupper">,
2221 <ref id="isxdigit" name="isxdigit">
2222 <tag/Example/None.
2223 </descrip>
2224 </quote>
2225
2226
2227 <sect1>iscntrl<label id="iscntrl"><p>
2228
2229 <quote>
2230 <descrip>
2231 <tag/Function/Check if a given character is a control character.
2232 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2233 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
2234 <tag/Description/The function returns a value of zero if the given argument
2235 is a control character. The return value is non zero if the character
2236 is anything else.
2237 <tag/Limits/<itemize>
2238 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2239 inline sequence generated by the macro will not work correctly for values
2240 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2241 this range. The non inline function may be accessed by <tt/#undef/'ing the
2242 macro.
2243 <item>When compiling without <tt/-Os/, the function is only available as
2244 fastcall function, so it may only be used in presence of a prototype.
2245 </itemize>
2246 <tag/Availability/ISO 9899
2247 <tag/See also/
2248 <ref id="isalnum" name="isalnum">,
2249 <ref id="isalpha" name="isalpha">,
2250 <ref id="isascii" name="isascii">,
2251 <ref id="isblank" name="isblank">,
2252 <ref id="isdigit" name="isdigit">,
2253 <ref id="isgraph" name="isgraph">,
2254 <ref id="islower" name="islower">,
2255 <ref id="isprint" name="isprint">,
2256 <ref id="ispunct" name="ispunct">,
2257 <ref id="isspace" name="isspace">,
2258 <ref id="isupper" name="isupper">,
2259 <ref id="isxdigit" name="isxdigit">
2260 <tag/Example/None.
2261 </descrip>
2262 </quote>
2263
2264
2265 <sect1>isdigit<label id="isdigit"><p>
2266
2267 <quote>
2268 <descrip>
2269 <tag/Function/Check if a given character is a digit.
2270 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2271 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
2272 <tag/Description/The function returns a value of zero if the given argument
2273 is a digit. The return value is non zero if the character is anything else.
2274 <tag/Limits/<itemize>
2275 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2276 inline sequence generated by the macro will not work correctly for values
2277 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2278 this range. The non inline function may be accessed by <tt/#undef/'ing the
2279 macro.
2280 <item>When compiling without <tt/-Os/, the function is only available as
2281 fastcall function, so it may only be used in presence of a prototype.
2282 </itemize>
2283 <tag/Availability/ISO 9899
2284 <tag/See also/
2285 <ref id="isalnum" name="isalnum">,
2286 <ref id="isalpha" name="isalpha">,
2287 <ref id="isascii" name="isascii">,
2288 <ref id="isblank" name="isblank">,
2289 <ref id="iscntrl" name="iscntrl">,
2290 <ref id="isgraph" name="isgraph">,
2291 <ref id="islower" name="islower">,
2292 <ref id="isprint" name="isprint">,
2293 <ref id="ispunct" name="ispunct">,
2294 <ref id="isspace" name="isspace">,
2295 <ref id="isupper" name="isupper">,
2296 <ref id="isxdigit" name="isxdigit">
2297 <tag/Example/None.
2298 </descrip>
2299 </quote>
2300
2301
2302 <sect1>isgraph<label id="isgraph"><p>
2303
2304 <quote>
2305 <descrip>
2306 <tag/Function/Check if a given character is a printable character (except
2307 space).
2308 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2309 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
2310 <tag/Description/The function returns a value of zero if the given argument
2311 is a printable character with the exception of space. The return value is non
2312 zero if the character is anything else.
2313 <tag/Limits/<itemize>
2314 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2315 inline sequence generated by the macro will not work correctly for values
2316 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2317 this range. The non inline function may be accessed by <tt/#undef/'ing the
2318 macro.
2319 <item>When compiling without <tt/-Os/, the function is only available as
2320 fastcall function, so it may only be used in presence of a prototype.
2321 </itemize>
2322 <tag/Availability/ISO 9899
2323 <tag/See also/
2324 <ref id="isalnum" name="isalnum">,
2325 <ref id="isalpha" name="isalpha">,
2326 <ref id="isascii" name="isascii">,
2327 <ref id="isblank" name="isblank">,
2328 <ref id="iscntrl" name="iscntrl">,
2329 <ref id="isdigit" name="isdigit">,
2330 <ref id="islower" name="islower">,
2331 <ref id="isprint" name="isprint">,
2332 <ref id="ispunct" name="ispunct">,
2333 <ref id="isspace" name="isspace">,
2334 <ref id="isupper" name="isupper">,
2335 <ref id="isxdigit" name="isxdigit">
2336 <tag/Example/None.
2337 </descrip>
2338 </quote>
2339
2340
2341 <sect1>islower<label id="islower"><p>
2342
2343 <quote>
2344 <descrip>
2345 <tag/Function/Check if a given character is a lower case letter.
2346 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2347 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
2348 <tag/Description/The function returns a value of zero if the given argument
2349 is a lower case letter. The return value is non zero if the character is
2350 anything else.
2351 <tag/Limits/<itemize>
2352 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2353 inline sequence generated by the macro will not work correctly for values
2354 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2355 this range. The non inline function may be accessed by <tt/#undef/'ing the
2356 macro.
2357 <item>When compiling without <tt/-Os/, the function is only available as
2358 fastcall function, so it may only be used in presence of a prototype.
2359 </itemize>
2360 <tag/Availability/ISO 9899
2361 <tag/See also/
2362 <ref id="isalnum" name="isalnum">,
2363 <ref id="isalpha" name="isalpha">,
2364 <ref id="isascii" name="isascii">,
2365 <ref id="isblank" name="isblank">,
2366 <ref id="iscntrl" name="iscntrl">,
2367 <ref id="isdigit" name="isdigit">,
2368 <ref id="isgraph" name="isgraph">,
2369 <ref id="isprint" name="isprint">,
2370 <ref id="ispunct" name="ispunct">,
2371 <ref id="isspace" name="isspace">,
2372 <ref id="isupper" name="isupper">,
2373 <ref id="isxdigit" name="isxdigit">
2374 <tag/Example/None.
2375 </descrip>
2376 </quote>
2377
2378
2379 <sect1>isprint<label id="isprint"><p>
2380
2381 <quote>
2382 <descrip>
2383 <tag/Function/Check if a given character is a printable character.
2384 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2385 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
2386 <tag/Description/The function returns a value of zero if the given argument
2387 is a printable character (this includes the space character). The return value
2388 is non zero if the character is anything else.
2389 <tag/Limits/<itemize>
2390 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2391 inline sequence generated by the macro will not work correctly for values
2392 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2393 this range. The non inline function may be accessed by <tt/#undef/'ing the
2394 macro.
2395 <item>When compiling without <tt/-Os/, the function is only available as
2396 fastcall function, so it may only be used in presence of a prototype.
2397 </itemize>
2398 <tag/Availability/ISO 9899
2399 <tag/See also/
2400 <ref id="isalnum" name="isalnum">,
2401 <ref id="isalpha" name="isalpha">,
2402 <ref id="isascii" name="isascii">,
2403 <ref id="isblank" name="isblank">,
2404 <ref id="iscntrl" name="iscntrl">,
2405 <ref id="isdigit" name="isdigit">,
2406 <ref id="isgraph" name="isgraph">,
2407 <ref id="islower" name="islower">,
2408 <ref id="ispunct" name="ispunct">,
2409 <ref id="isspace" name="isspace">,
2410 <ref id="isupper" name="isupper">,
2411 <ref id="isxdigit" name="isxdigit">
2412 <tag/Example/None.
2413 </descrip>
2414 </quote>
2415
2416
2417 <sect1>ispunct<label id="ispunct"><p>
2418
2419 <quote>
2420 <descrip>
2421 <tag/Function/Check if a given character is a printable character but not a
2422 space or an alphanumeric character.
2423 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2424 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2425 <tag/Description/The function returns a value of zero if the given argument
2426 is a printable character, but not a space or anything alphanumeric. The return
2427 value is non zero if the character is anything else.
2428 <tag/Limits/<itemize>
2429 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2430 inline sequence generated by the macro will not work correctly for values
2431 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2432 this range. The non inline function may be accessed by <tt/#undef/'ing the
2433 macro.
2434 <item>When compiling without <tt/-Os/, the function is only available as
2435 fastcall function, so it may only be used in presence of a prototype.
2436 </itemize>
2437 <tag/Availability/ISO 9899
2438 <tag/See also/
2439 <ref id="isalnum" name="isalnum">,
2440 <ref id="isalpha" name="isalpha">,
2441 <ref id="isascii" name="isascii">,
2442 <ref id="isblank" name="isblank">,
2443 <ref id="iscntrl" name="iscntrl">,
2444 <ref id="isdigit" name="isdigit">,
2445 <ref id="isgraph" name="isgraph">,
2446 <ref id="islower" name="islower">,
2447 <ref id="isprint" name="isprint">,
2448 <ref id="isspace" name="isspace">,
2449 <ref id="isupper" name="isupper">,
2450 <ref id="isxdigit" name="isxdigit">
2451 <tag/Example/None.
2452 </descrip>
2453 </quote>
2454
2455
2456 <sect1>isspace<label id="isspace"><p>
2457
2458 <quote>
2459 <descrip>
2460 <tag/Function/Check if a given character is a a white-space character.
2461 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2462 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2463 <tag/Description/The function returns a value of zero if the given argument
2464 is a white space character. The return value is non zero if the character is
2465 anything else. The standard white space characters are: space, formfeed ('\f'),
2466 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2467 ('\v').
2468 <tag/Limits/<itemize>
2469 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2470 inline sequence generated by the macro will not work correctly for values
2471 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2472 this range. The non inline function may be accessed by <tt/#undef/'ing the
2473 macro.
2474 <item>When compiling without <tt/-Os/, the function is only available as
2475 fastcall function, so it may only be used in presence of a prototype.
2476 </itemize>
2477 <tag/Availability/ISO 9899
2478 <tag/See also/
2479 <ref id="isalnum" name="isalnum">,
2480 <ref id="isalpha" name="isalpha">,
2481 <ref id="isascii" name="isascii">,
2482 <ref id="isblank" name="isblank">,
2483 <ref id="iscntrl" name="iscntrl">,
2484 <ref id="isdigit" name="isdigit">,
2485 <ref id="isgraph" name="isgraph">,
2486 <ref id="islower" name="islower">,
2487 <ref id="isprint" name="isprint">,
2488 <ref id="ispunct" name="ispunct">,
2489 <ref id="isupper" name="isupper">,
2490 <ref id="isxdigit" name="isxdigit">
2491 <tag/Example/None.
2492 </descrip>
2493 </quote>
2494
2495
2496 <sect1>isupper<label id="isupper"><p>
2497
2498 <quote>
2499 <descrip>
2500 <tag/Function/Check if a given character is an upper case letter.
2501 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2502 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2503 <tag/Description/The function returns a value of zero if the given argument
2504 is an upper case letter. The return value is non zero if the character is
2505 anything else.
2506 <tag/Limits/<itemize>
2507 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2508 inline sequence generated by the macro will not work correctly for values
2509 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2510 this range. The non inline function may be accessed by <tt/#undef/'ing the
2511 macro.
2512 <item>When compiling without <tt/-Os/, the function is only available as
2513 fastcall function, so it may only be used in presence of a prototype.
2514 </itemize>
2515 <tag/Availability/ISO 9899
2516 <tag/See also/
2517 <ref id="isalnum" name="isalnum">,
2518 <ref id="isalpha" name="isalpha">,
2519 <ref id="isascii" name="isascii">,
2520 <ref id="isblank" name="isblank">,
2521 <ref id="iscntrl" name="iscntrl">,
2522 <ref id="isdigit" name="isdigit">,
2523 <ref id="isgraph" name="isgraph">,
2524 <ref id="islower" name="islower">,
2525 <ref id="isprint" name="isprint">,
2526 <ref id="ispunct" name="ispunct">,
2527 <ref id="isspace" name="isspace">,
2528 <ref id="isxdigit" name="isxdigit">
2529 <tag/Example/None.
2530 </descrip>
2531 </quote>
2532
2533
2534 <sect1>isxdigit<label id="isxdigit"><p>
2535
2536 <quote>
2537 <descrip>
2538 <tag/Function/Check if a given character is a hexadecimal digit.
2539 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2540 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2541 <tag/Description/The function returns a value of zero if the given argument
2542 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2543 if the character is anything else.
2544 <tag/Limits/<itemize>
2545 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2546 inline sequence generated by the macro will not work correctly for values
2547 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2548 this range. The non inline function may be accessed by <tt/#undef/'ing the
2549 macro.
2550 <item>When compiling without <tt/-Os/, the function is only available as
2551 fastcall function, so it may only be used in presence of a prototype.
2552 </itemize>
2553 <tag/Availability/ISO 9899
2554 <tag/See also/
2555 <ref id="isalnum" name="isalnum">,
2556 <ref id="isalpha" name="isalpha">,
2557 <ref id="isascii" name="isascii">,
2558 <ref id="isblank" name="isblank">,
2559 <ref id="iscntrl" name="iscntrl">,
2560 <ref id="isdigit" name="isdigit">,
2561 <ref id="isgraph" name="isgraph">,
2562 <ref id="islower" name="islower">,
2563 <ref id="isprint" name="isprint">,
2564 <ref id="ispunct" name="ispunct">,
2565 <ref id="isspace" name="isspace">,
2566 <ref id="isupper" name="isupper">
2567 <tag/Example/None.
2568 </descrip>
2569 </quote>
2570
2571
2572 <sect1>itoa<label id="itoa"><p>
2573
2574 <quote>
2575 <descrip>
2576 <tag/Function/Convert an integer into a string.
2577 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2578 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2579 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2580 <tt/radix/ as the base.
2581 <tag/Limits/<itemize>
2582 <item>There are no provisions to prevent a buffer overflow.
2583 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2584 <item>The function is non standard, so it is not available in strict ANSI mode.
2585 You should probably use <tt/sprintf/ instead.
2586 <item>The function is only available as fastcall function, so it may only be
2587 used in presence of a prototype.
2588 </itemize>
2589 <tag/Availability/cc65
2590 <tag/See also/
2591 <ref id="atoi" name="atoi">,
2592 <ref id="atol" name="atol">,
2593 <ref id="ltoa" name="ltoa">,
2594 <ref id="ultoa" name="ultoa">,
2595 <ref id="utoa" name="utoa">
2596 <tag/Example/None.
2597 </descrip>
2598 </quote>
2599
2600
2601 <sect1>kbhit<label id="kbhit"><p>
2602
2603 <quote>
2604 <descrip>
2605 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2606 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2607 <tag/Declaration/<tt/unsigned char kbhit (void);/
2608 <tag/Description/The function returns a value of zero if there is no character
2609 waiting to be read from the keyboard. It returns non zero otherwise.
2610 <tag/Limits/<itemize>
2611 <item>If the system does not support a keyboard buffer (most systems
2612 do), the function is rather useless.
2613 </itemize>
2614 <tag/Availability/cc65
2615 <tag/See also/
2616 <ref id="cgetc" name="cgetc">,
2617 <ref id="cursor" name="cursor">
2618 <tag/Example/None.
2619 </descrip>
2620 </quote>
2621
2622
2623 <sect1>labs<label id="labs"><p>
2624
2625 <quote>
2626 <descrip>
2627 <tag/Function/Returns the absolute value of a long integer.
2628 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2629 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2630 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2631 the function.
2632 <tag/Limits/<itemize>
2633 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2634 <item>The function is only available as fastcall function, so it may only be
2635 used in presence of a prototype.
2636 </itemize>
2637 <tag/Availability/ISO 9899
2638 <tag/See also/
2639 <ref id="abs" name="abs">
2640 <tag/Example/None.
2641 </descrip>
2642 </quote>
2643
2644
2645 <sect1>ltoa<label id="ltoa"><p>
2646
2647 <quote>
2648 <descrip>
2649 <tag/Function/Convert a long integer into a string.
2650 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2651 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
2652 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
2653 using <tt/radix/ as the base.
2654 <tag/Limits/<itemize>
2655 <item>There are no provisions to prevent a buffer overflow.
2656 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
2657 <item>The function is non standard, so it is not available in strict ANSI mode.
2658 You should probably use <tt/sprintf/ instead.
2659 <item>The function is only available as fastcall function, so it may only be
2660 used in presence of a prototype.
2661 </itemize>
2662 <tag/Availability/cc65
2663 <tag/See also/
2664 <ref id="atoi" name="atoi">,
2665 <ref id="atol" name="atol">,
2666 <ref id="itoa" name="itoa">,
2667 <ref id="ultoa" name="ultoa">,
2668 <ref id="utoa" name="utoa">
2669 <tag/Example/None.
2670 </descrip>
2671 </quote>
2672
2673
2674 <sect1>localeconv<label id="localeconv"><p>
2675
2676 <quote>
2677 <descrip>
2678 <tag/Function/Returns a pointer to the current locale structure.
2679 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
2680 <tag/Declaration/<tt/struct lconv* localeconv (void);/
2681 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
2682 structure.
2683 <tag/Limits/<itemize>
2684 <item>cc65 supports only the "C" locale, so even after setting a new locale
2685 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
2686 always be the same.
2687 </itemize>
2688 <tag/Availability/ISO 9899
2689 <tag/See also/
2690 <ref id="setlocale" name="setlocale">
2691 <tag/Example/None.
2692 </descrip>
2693 </quote>
2694
2695
2696 <sect1>malloc<label id="malloc"><p>
2697
2698 <quote>
2699 <descrip>
2700 <tag/Function/Allocate dynamic memory.
2701 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2702 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
2703 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
2704 pointer to the allocated memory block. On error (not enough memory available),
2705 <tt/malloc/ returns <tt/NULL/.
2706 <tag/Limits/
2707 <itemize>
2708 <item>The function is only available as fastcall function, so it may only
2709 be used in presence of a prototype.
2710 </itemize>
2711 <tag/Availability/ISO 9899
2712 <tag/See also/
2713 <ref id="_heapadd" name="_heapadd">,
2714 <ref id="_heapblocksize" name="_heapblocksize">,
2715 <ref id="_heapmaxavail" name="_heapmaxavail">,
2716 <ref id="_heapmemavail" name="_heapmemavail">,
2717 <ref id="calloc" name="calloc">,
2718 <ref id="free" name="free">,
2719 <ref id="realloc" name="realloc">,
2720 <ref id="strdup" name="strdup">
2721 <tag/Example/None.
2722 </descrip>
2723 </quote>
2724
2725
2726 <sect1>memchr<label id="memchr"><p>
2727
2728 <quote>
2729 <descrip>
2730 <tag/Function/Search for a character in a block of raw memory.
2731 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2732 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
2733 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
2734 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
2735 that is of size <tt/count/. Upon completion, the function returns a pointer to
2736 the character found, or a null pointer if the character was not found.
2737 <tag/Limits/<itemize>
2738 <item>The function is only available as fastcall function, so it may only
2739 be used in presence of a prototype.
2740 </itemize>
2741 <tag/Availability/ISO 9899
2742 <tag/See also/
2743 <ref id="strchr" name="strchr">
2744 <tag/Example/None.
2745 </descrip>
2746 </quote>
2747
2748
2749 <sect1>memcpy<label id="memcpy"><p>
2750
2751 <quote>
2752 <descrip>
2753 <tag/Function/Copy a memory area.
2754 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2755 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
2756 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
2757 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
2758 <tt/dest/.
2759 <tag/Limits/
2760 <itemize>
2761 <item>The result is undefined if the memory areas do overlap. Use
2762 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
2763 <item>The function is only available as fastcall function, so it may only
2764 be used in presence of a prototype.
2765 </itemize>
2766 <tag/Availability/ISO 9899
2767 <tag/See also/
2768 <ref id="_swap" name="_swap">,
2769 <ref id="memmove" name="memmove">,
2770 <ref id="memset" name="memset">
2771 <tag/Example/None.
2772 </descrip>
2773 </quote>
2774
2775
2776 <sect1>memmove<label id="memmove"><p>
2777
2778 <quote>
2779 <descrip>
2780 <tag/Function/Copy a memory area.
2781 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2782 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
2783 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
2784 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
2785 <tt/dest/.
2786 <tag/Limits/
2787 <itemize>
2788 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
2789 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
2790 <item>The function is only available as fastcall function, so it may only
2791 be used in presence of a prototype.
2792 </itemize>
2793 <tag/Availability/ISO 9899
2794 <tag/See also/
2795 <ref id="_swap" name="_swap">,
2796 <ref id="memcpy" name="memcpy">,
2797 <ref id="memset" name="memset">
2798 <tag/Example/None.
2799 </descrip>
2800 </quote>
2801
2802
2803 <sect1>memset<label id="memset"><p>
2804
2805 <quote>
2806 <descrip>
2807 <tag/Function/Fill a memory area.
2808 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2809 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
2810 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
2811 the value <tt/val/. The function returns <tt/p/.
2812 <tag/Limits/
2813 <itemize>
2814 <item>The function is only available as fastcall function, so it may only
2815 be used in presence of a prototype.
2816 </itemize>
2817 <tag/Availability/ISO 9899
2818 <tag/See also/
2819 <ref id="_swap" name="_swap">,
2820 <ref id="bzero" name="bzero">,
2821 <ref id="memcpy" name="memcpy">,
2822 <ref id="memmove" name="memmove">
2823 <tag/Example/None.
2824 </descrip>
2825 </quote>
2826
2827
2828 <sect1>mod_free<label id="mod_free"><p>
2829
2830 <quote>
2831 <descrip>
2832 <tag/Function/Free a relocatable module.
2833 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
2834 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
2835 <tag/Description/The function will free a module loaded into memory by use of
2836 the <tt/<ref id="mod_load" name="mod_load">/ function.
2837 <tag/Limits/<itemize>
2838 <item>The pointer passed as parameter is the pointer to the module memory,
2839 not the pointer to the control structure.
2840 </itemize>
2841 <tag/Availability/cc65
2842 <tag/See also/
2843 <ref id="mod_load" name="mod_load">
2844 <tag/Example/None.
2845 </descrip>
2846 </quote>
2847
2848
2849 <sect1>mod_load<label id="mod_load"><p>
2850
2851 <quote>
2852 <descrip>
2853 <tag/Function/Load a relocatable module.
2854 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
2855 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
2856 <tag/Description/The function will load a code module into memory and relocate
2857 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
2858 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
2859 the module just loaded. Possible error codes are:
2860 <itemize>
2861 <item><tt/MLOAD_OK/ - Module load successful
2862 <item><tt/MLOAD_ERR_READ/ - Read error
2863 <item><tt/MLOAD_ERR_HDR/ - Header error
2864 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
2865 <item><tt/MLOAD_ERR_FMT/ - Data format error
2866 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
2867 </itemize>
2868 <tag/Limits/<itemize>
2869 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
2870 relocatable o65 modules for use with this function.
2871 </itemize>
2872 <tag/Availability/cc65
2873 <tag/See also/
2874 <ref id="mod_free" name="mod_free">
2875 <tag/Example/None.
2876 </descrip>
2877 </quote>
2878
2879
2880 <sect1>offsetof<label id="offsetof"><p>
2881
2882 <quote>
2883 <descrip>
2884 <tag/Function/Calculate the offset of a struct or union member.
2885 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
2886 <tag/Declaration/<tt/size_t offsetof (type, member);/
2887 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
2888 or <tt/union/ member.
2889 <tag/Limits/<itemize>
2890 <item>The function is actually a macro.
2891 </itemize>
2892 <tag/Availability/ISO 9899
2893 <tag/Example/None.
2894 </descrip>
2895 </quote>
2896
2897
2898 <sect1>open<label id="open"><p>
2899
2900 <quote>
2901 <descrip>
2902 <tag/Function/Open and possibly create a file.
2903 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2904 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
2905 <tag/Description/<tt/open/ opens a file and returns the file descriptor
2906 associated with it. On error, -1 is returned and an error code is stored in
2907 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
2908 <tag/Limits/<itemize>
2909 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
2910 open, which is used as the permission mask when a new file is created. While
2911 cc65 allows to pass this argument, it is ignored.
2912 </itemize>
2913 <tag/Availability/POSIX 1003.1
2914 <tag/See also/
2915 <ref id="close" name="close">,
2916 <ref id="creat" name="creat">
2917 <tag/Example/None.
2918 </descrip>
2919 </quote>
2920
2921
2922 <sect1>perror<label id="perror"><p>
2923
2924 <quote>
2925 <descrip>
2926 <tag/Function/Print an error message for the error in <tt/errno/.
2927 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2928 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
2929 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
2930 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
2931 a blank. Then the error message for the current contents of <tt/errno/ is
2932 printed followed by a newline. The message output is the same as returned by
2933 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
2934 <tag/Limits/
2935 <itemize>
2936 <item>The function is only available as fastcall function, so it may only
2937 be used in presence of a prototype.
2938 </itemize>
2939 <tag/Availability/ISO 9899
2940 <tag/See also/
2941 <ref id="_poserror" name="_poserror">,
2942 <ref id="strerror" name="strerror">,
2943 <tag/Example/None.
2944 </descrip>
2945 </quote>
2946
2947
2948 <sect1>qsort<label id="qsort"><p>
2949
2950 <quote>
2951 <descrip>
2952 <tag/Function/Sort an array.
2953 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2954 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
2955 size_t size, int (*compare) (const void*, const void*));/
2956 <tag/Description/<tt/qsort/ sorts an array according to a given compare
2957 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
2958 is the number of elements, <tt/size/ the size of an element and <tt/compare/
2959 the function used to compare the members.
2960 <tag/Limits/
2961 <itemize>
2962 <item>If there are multiple members with the same key, the order after calling
2963 the function is undefined.
2964 <item>The function is only available as fastcall function, so it may only
2965 be used in presence of a prototype.
2966 </itemize>
2967 <tag/Availability/ISO 9899
2968 <tag/See also/
2969 <ref id="bsearch" name="bsearch">
2970 <tag/Example/None.
2971 </descrip>
2972 </quote>
2973
2974
2975 <sect1>raise<label id="raise"><p>
2976
2977 <quote>
2978 <descrip>
2979 <tag/Function/Send a signal to the executing program.
2980 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
2981 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
2982 <tag/Description/<tt/raise/ sends the given signal to the program. If the
2983 program has installed a signal handler for the signal, this signal handler
2984 will be executed. If no handler has been installed, the default action for
2985 the raised signal will be taken. The function returns zero on success,
2986 nonzero otherwise.
2987 <tag/Limits/<itemize>
2988 <item>The function is only available as fastcall function, so it may only
2989 be used in presence of a prototype.
2990 </itemize>
2991 <tag/Availability/ISO 9899
2992 <tag/See also/
2993 <ref id="abort" name="abort">,
2994 <ref id="signal" name="signal">
2995 <tag/Example/None.
2996 </descrip>
2997 </quote>
2998
2999
3000 <sect1>rand<label id="rand"><p>
3001
3002 <quote>
3003 <descrip>
3004 <tag/Function/Return a pseudo random number.
3005 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3006 <tag/Declaration/<tt/int rand (void);/
3007 <tag/Description/The function returns a pseudo random number
3008 between 0 and <tt/RAND_MAX/ (exclusive).
3009 <tag/Limits/<itemize>
3010 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
3011 flow of numbers is generated.
3012 <item>On startup, the function behaves as if <ref id="srand" name="srand">
3013 had been used with an argument of 1.
3014 </itemize>
3015 <tag/Availability/ISO 9899
3016 <tag/See also/
3017 <ref id="_randomize" name="_randomize">,
3018 <ref id="srand" name="srand">
3019 <tag/Example/None.
3020 </descrip>
3021 </quote>
3022
3023
3024 <sect1>realloc<label id="realloc"><p>
3025
3026 <quote>
3027 <descrip>
3028 <tag/Function/Change the size of an allocated memory block.
3029 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3030 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
3031 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
3032 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
3033 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
3034 behaves as if <tt/free/ had been called. On error (not enough memory
3035 available), <tt/realloc/ returns <tt/NULL/.
3036 <tag/Limits/
3037 <itemize>
3038 <item>The part of the memory block that is returned will have its contents
3039 unchanged.
3040 <item>This function is somewhat dangerous to use. Be careful to save the
3041 pointer you're passing somewhere else, otherwise
3042 <tscreen><verb>
3043         ptr = realloc (ptr, size);
3044 </verb></tscreen>
3045 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
3046 <item>The function is only available as fastcall function, so it may only
3047 be used in presence of a prototype.
3048 </itemize>
3049 <tag/Availability/ISO 9899
3050 <tag/See also/
3051 <ref id="_heapadd" name="_heapadd">,
3052 <ref id="_heapblocksize" name="_heapblocksize">,
3053 <ref id="_heapmaxavail" name="_heapmaxavail">,
3054 <ref id="_heapmemavail" name="_heapmemavail">,
3055 <ref id="calloc" name="calloc">,
3056 <ref id="free" name="free">,
3057 <ref id="realloc" name="realloc">
3058 <tag/Example/None.
3059 </descrip>
3060 </quote>
3061
3062
3063 <sect1>remove<label id="remove"><p>
3064
3065 <quote>
3066 <descrip>
3067 <tag/Function/Delete a file.
3068 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3069 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
3070 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
3071 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3072 code describing the reason for the failure.
3073 <tag/Limits/
3074 <itemize>
3075 <item>This function is not available on all cc65 targets (depends on the
3076 availability of file I/O).
3077 <item>The function is only available as fastcall function, so it may only
3078 be used in presence of a prototype.
3079 </itemize>
3080 <tag/Availability/ISO 9899
3081 <tag/See also/
3082 <ref id="unlink" name="unlink">
3083 <tag/Example/
3084 #include &lt;stdio.h&gt;
3085
3086 #define FILENAME "helloworld"
3087
3088 if (remove (FILENAME) == 0) {
3089     printf ("We deleted %s successfully\n", FILENAME);
3090 } else {
3091     printf ("There was a problem deleting %s\n", FILENAME);
3092 }
3093 </descrip>
3094 </quote>
3095
3096
3097 <sect1>reset_brk<label id="reset_brk"><p>
3098
3099 <quote>
3100 <descrip>
3101 <tag/Function/Resets the break vector to its original value.
3102 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3103 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
3104 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
3105 before a call to <tt/set_brk/.
3106 <tag/Limits/
3107 <itemize>
3108 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
3109 it is not strictly necessary to call this function as part of the cleanup when
3110 the program ends.
3111 </itemize>
3112 <tag/Availability/cc65
3113 <tag/See also/
3114 <ref id="set_brk" name="set_brk">
3115 <tag/Example/None.
3116 </descrip>
3117 </quote>
3118
3119
3120 <sect1>revers<label id="revers"><p>
3121
3122 <quote>
3123 <descrip>
3124 <tag/Function/Control revers character display.
3125 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3126 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
3127 <tag/Description/If the argument is non zero, the function enables reverse
3128 character display. If the argument is zero, reverse character display is
3129 switched off. The old value of the setting is returned.
3130 <tag/Limits/<itemize>
3131 <item>The function may not be supported by the hardware, in which case
3132 the call is ignored.
3133 <item>The function is only available as fastcall function, so it may only
3134 be used in presence of a prototype.
3135 </itemize>
3136 <tag/Availability/cc65
3137 <tag/See also/
3138 <ref id="textcolor" name="textcolor">
3139 <tag/Example/None.
3140 </descrip>
3141 </quote>
3142
3143
3144 <sect1>screensize<label id="screensize"><p>
3145
3146 <quote>
3147 <descrip>
3148 <tag/Function/Return the dimensions of the text mode screen.
3149 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3150 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
3151 <tag/Description/The function returns the dimensions of the text mode screen.
3152 <tag/Limits/<itemize>
3153 <item>The function is only available as fastcall function, so it may only
3154 be used in presence of a prototype.
3155 </itemize>
3156 <tag/Availability/cc65
3157 <tag/See also/
3158 <ref id="gotox" name="gotox">,
3159 <ref id="gotoxy" name="gotoxy">,
3160 <ref id="gotoy" name="gotoy">,
3161 <ref id="wherex" name="wherex">,
3162 <ref id="wherey" name="wherey">
3163 <tag/Example/None.
3164 </descrip>
3165 </quote>
3166
3167
3168 <sect1>set_brk<label id="set_brk"><p>
3169
3170 <quote>
3171 <descrip>
3172 <tag/Function/Set the break vector to a user function.
3173 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3174 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
3175 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
3176 program code by letting the vector point to a user written C function. The
3177 runtime library installs a small stub that saves the registers into global
3178 variables that may be accessed (and changed) by the break handler.
3179 <tag/Limits/
3180 <itemize>
3181 <item>The function is only available as fastcall function, so it may only
3182 be used in presence of a prototype.
3183 <item>The stub saves the zero page registers used by the C runtime and switches
3184 to a small break handler stack. This means that it is safe to execute C code,
3185 even if C code was interrupted. Be careful however not to use too many local
3186 variables, and do not enable stack checks for the handler function or any other
3187 function called from it.
3188 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
3189 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
3190 otherwise the <tt/BRK/ instruction will get executed over and over again.
3191 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
3192 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
3193 the program terminates.
3194 </itemize>
3195 <tag/Availability/cc65
3196 <tag/See also/
3197 <ref id="reset_brk" name="reset_brk">
3198 <tag/Example/None.
3199 </descrip>
3200 </quote>
3201
3202
3203 <sect1>setlocale<label id="setlocale"><p>
3204
3205 <quote>
3206 <descrip>
3207 <tag/Function/Selects a locale.
3208 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3209 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
3210 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
3211 <tag/Limits/
3212 <itemize>
3213 <item>The function is only available as fastcall function, so it may only
3214 be used in presence of a prototype.
3215 <item>cc65 supports only the "C" locale, so calling this function to set a
3216 different locale has no effect.
3217 </itemize>
3218 <tag/Availability/ISO 9899
3219 <tag/See also/
3220 <ref id="localeconv" name="localeconv">,
3221 <ref id="strcoll" name="strcoll">
3222 <tag/Example/None.
3223 </descrip>
3224 </quote>
3225
3226
3227 <sect1>signal<label id="signal"><p>
3228
3229 <quote>
3230 <descrip>
3231 <tag/Function/Install a signal handler.
3232 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
3233 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
3234 <tag/Description/<tt/signal/ installs a handler for the given signal. The
3235 handler may either be a user supplied function, or one of the predefined
3236 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
3237 previous value if the signal , or the special function vector SIG_ERR in
3238 case of an error.
3239 <tag/Limits/<itemize>
3240 <item>The function is only available as fastcall function, so it may only
3241 be used in presence of a prototype.
3242 </itemize>
3243 <tag/Availability/ISO 9899
3244 <tag/See also/
3245 <ref id="abort" name="abort">,
3246 <ref id="raise" name="raise">
3247 <tag/Example/None.
3248 </descrip>
3249 </quote>
3250
3251
3252 <sect1>sleep<label id="sleep"><p>
3253
3254 <quote>
3255 <descrip>
3256 <tag/Function/Sleep for a specified amount of time.
3257 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3258 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
3259 <tag/Description/The function will return after the specified number of
3260 seconds have elapsed.
3261 <tag/Limits/<itemize>
3262 <item>The function is only available as fastcall function, so it may only
3263 be used in presence of a prototype.
3264 </itemize>
3265 <tag/Availability/POSIX 1003.1
3266 <tag/Example/None.
3267 </descrip>
3268 </quote>
3269
3270
3271 <sect1>slow<label id="slow"><p>
3272
3273 <quote>
3274 <descrip>
3275 <tag/Function/Switch the C128 into 1MHz mode.
3276 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3277 <tag/Declaration/<tt/void slow (void);/
3278 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
3279 will halve the speed compared to fast mode.
3280 <tag/Limits/<itemize>
3281 <item>The function is specific to the C128.
3282 </itemize>
3283 <tag/Availability/C128
3284 <tag/See also/
3285 <ref id="fast" name="fast">,
3286 <ref id="toggle_videomode" name="toggle_videomode">
3287 <tag/Example/None.
3288 </descrip>
3289 </quote>
3290
3291
3292 <sect1>srand<label id="srand"><p>
3293
3294 <quote>
3295 <descrip>
3296 <tag/Function/Initialize the pseudo random number generator.
3297 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3298 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
3299 <tag/Description/The function initializes the random number generator using
3300 the given seed. On program startup, the generator behaves as if <tt/srand/ has
3301 been called with an argument of 1.
3302 <tag/Limits/<itemize>
3303 <item>The function is only available as fastcall function, so it may only
3304 be used in presence of a prototype.
3305 </itemize>
3306 <tag/Availability/ISO 9899
3307 <tag/See also/
3308 <ref id="_randomize" name="_randomize">,
3309 <ref id="rand" name="rand">
3310 <tag/Example/None.
3311 </descrip>
3312 </quote>
3313
3314
3315 <sect1>strcasecmp<label id="strcasecmp"><p>
3316
3317 <quote>
3318 <descrip>
3319 <tag/Function/Compare two strings case insensitive.
3320 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3321 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
3322 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
3323 as parameters without case sensitivity. It returns a value that is less than
3324 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
3325 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
3326 <tag/Limits/<itemize>
3327 <item>The function is only available as fastcall function, so it may only
3328 be used in presence of a prototype.
3329 <item>The function is not available in strict ANSI mode.
3330 </itemize>
3331 <tag/Availability/cc65
3332 <tag/See also/
3333 <ref id="strcmp" name="strcmp">,
3334 <ref id="strcoll" name="strcoll">,
3335 <ref id="stricmp" name="stricmp">,
3336 <ref id="strncmp" name="strncmp">
3337 <tag/Example/None.
3338 </descrip>
3339 </quote>
3340
3341
3342 <sect1>strcat<label id="strcat"><p>
3343
3344 <quote>
3345 <descrip>
3346 <tag/Function/Concatentate two strings.
3347 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3348 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
3349 <tag/Description/The <tt/strcat/ function appends a copy of the string
3350 pointed to by s2 (including the terminating null byte) to the end of the
3351 string pointed to by s1. The initial byte of s2 overwrites the null byte at
3352 the end of s1.
3353 <tag/Limits/<itemize>
3354 <item>The function is only available as fastcall function, so it may only
3355 be used in presence of a prototype.
3356 <item>If copying takes place between objects that overlap, the behavior
3357 is undefined.
3358 </itemize>
3359 <tag/Availability/ISO 9899
3360 <tag/See also/
3361 <ref id="strcpy" name="strcpy">,
3362 <ref id="strncat" name="strncat">,
3363 <ref id="strncpy" name="strncpy">
3364 <tag/Example/None.
3365 </descrip>
3366 </quote>
3367
3368
3369 <sect1>strchr<label id="strchr"><p>
3370
3371 <quote>
3372 <descrip>
3373 <tag/Function/Search for a character in a string.
3374 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3375 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
3376 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
3377 (converted to a char) in the string pointed to by <tt/s/. The terminating null
3378 byte is considered to be part of the string. Upon completion, the function
3379 returns a pointer to the byte, or a null pointer if the byte was not found.
3380 <tag/Limits/<itemize>
3381 <item>The function is only available as fastcall function, so it may only
3382 be used in presence of a prototype.
3383 </itemize>
3384 <tag/Availability/ISO 9899
3385 <tag/See also/
3386 <ref id="memchr" name="memchr">,
3387 <ref id="strrchr" name="strrchr">
3388 <tag/Example/None.
3389 </descrip>
3390 </quote>
3391
3392
3393 <sect1>strcmp<label id="strcmp"><p>
3394
3395 <quote>
3396 <descrip>
3397 <tag/Function/Compare two strings.
3398 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3399 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
3400 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
3401 parameters. It returns a value that is less than zero if <tt/s1/ is less than
3402 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
3403 if <tt/s1/ is greater than <tt/s2/.
3404 <tag/Limits/<itemize>
3405 <item>The function is only available as fastcall function, so it may only
3406 be used in presence of a prototype.
3407 </itemize>
3408 <tag/Availability/ISO 9899
3409 <tag/See also/
3410 <ref id="strcasecmp" name="strcasecmp">,
3411 <ref id="strcoll" name="strcoll">,
3412 <ref id="stricmp" name="stricmp">,
3413 <ref id="strncmp" name="strncmp">
3414 <tag/Example/None.
3415 </descrip>
3416 </quote>
3417
3418
3419 <sect1>strcoll<label id="strcoll"><p>
3420
3421 <quote>
3422 <descrip>
3423 <tag/Function/Compare two strings.
3424 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3425 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
3426 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
3427 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
3428 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
3429 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
3430 than zero if <tt/s1/ is greater than <tt/s2/.
3431 <tag/Limits/<itemize>
3432 <item>The function is only available as fastcall function, so it may only
3433 be used in presence of a prototype.
3434 </itemize>
3435 <tag/Availability/ISO 9899
3436 <tag/See also/
3437 <ref id="setlocale" name="setlocale">,
3438 <ref id="strcasecmp" name="strcasecmp">,
3439 <ref id="strcmp" name="strcmp">,
3440 <ref id="stricmp" name="stricmp">,
3441 <ref id="strncmp" name="strncmp">
3442 <tag/Example/None.
3443 </descrip>
3444 </quote>
3445
3446
3447 <sect1>strcpy<label id="strcpy"><p>
3448
3449 <quote>
3450 <descrip>
3451 <tag/Function/Copy a string.
3452 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3453 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
3454 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
3455 <tt/s2/ (including the terminating null byte) into the array pointed to by
3456 <tt/s1/. The function will always return <tt/s1/.
3457 <tag/Limits/<itemize>
3458 <item>The function is only available as fastcall function, so it may only
3459 be used in presence of a prototype.
3460 <item>If copying takes place between objects that overlap, the behavior
3461 is undefined.
3462 </itemize>
3463 <tag/Availability/ISO 9899
3464 <tag/See also/
3465 <ref id="strcat" name="strcat">,
3466 <ref id="strncat" name="strncat">,
3467 <ref id="strncpy" name="strncpy">
3468 <tag/Example/
3469 <verb>
3470 #include &lt;string.h&gt;
3471
3472 static char hello[14];
3473
3474 strcpy (hello, "Hello world!\n");
3475 </verb>
3476 </descrip>
3477 </quote>
3478
3479
3480 <sect1>strcspn<label id="strcspn"><p>
3481
3482 <quote>
3483 <descrip>
3484 <tag/Function/Compute the length of a substring.
3485 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3486 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
3487 <tag/Description/The <tt/strcspn/ function computes and returns the length of
3488 the substring pointed to by <tt/s/ which does <em>not</em> consist of
3489 characters contained in the string <tt/set/.
3490 <tag/Limits/<itemize>
3491 <item>The function is only available as fastcall function, so it may only
3492 be used in presence of a prototype.
3493 </itemize>
3494 <tag/Availability/ISO 9899
3495 <tag/See also/
3496 <ref id="strspn" name="strspn">,
3497 <ref id="strstr" name="strstr">
3498 <tag/Example/None.
3499 </descrip>
3500 </quote>
3501
3502
3503 <sect1>strdup<label id="strdup"><p>
3504
3505 <quote>
3506 <descrip>
3507 <tag/Function/Allocate a copy of a string on the heap.
3508 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3509 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
3510 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
3511 to hold a copy of <tt/s/ including the terminating zero. If the allocation
3512 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
3513 memory block, and a pointer to the block is returned.
3514 <tag/Limits/<itemize>
3515 <item>The function is only available as fastcall function, so it may only
3516 be used in presence of a prototype.
3517 <item>It is up to the caller to free the allocated memory block.
3518 </itemize>
3519 <tag/Availability/ISO 9899
3520 <tag/See also/
3521 <ref id="free" name="free">,
3522 <ref id="malloc" name="malloc">
3523 <tag/Example/None.
3524 </descrip>
3525 </quote>
3526
3527
3528 <sect1>strerror<label id="strerror"><p>
3529
3530 <quote>
3531 <descrip>
3532 <tag/Function/Return a string describing an error code.
3533 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3534 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
3535 <tag/Description/The <tt/strerror/ function returns a string describing the
3536 given error code. If an invalid error code is passed, the string "Unknown
3537 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
3538 <tt/errno/ is left untouched.
3539 <tag/Limits/<itemize>
3540 <item>The function is only available as fastcall function, so it may only
3541 be used in presence of a prototype.
3542 <item>While the return type of the function is a <tt/char*/, the returned
3543 string must not be modified by the caller!
3544 </itemize>
3545 <tag/Availability/ISO 9899
3546 <tag/See also/
3547 <ref id="_stroserror" name="_stroserror">
3548 <tag/Example/None.
3549 </descrip>
3550 </quote>
3551
3552
3553 <sect1>stricmp<label id="stricmp"><p>
3554
3555 <quote>
3556 <descrip>
3557 <tag/Function/Compare two strings case insensitive.
3558 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3559 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
3560 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
3561 parameters without case sensitivity. It returns a value that is less than zero
3562 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
3563 value greater than zero if <tt/s1/ is greater than <tt/s2/.
3564 <tag/Limits/<itemize>
3565 <item>The function is only available as fastcall function, so it may only
3566 be used in presence of a prototype.
3567 <item>The function is not available in strict ANSI mode.
3568 </itemize>
3569 <tag/Availability/cc65
3570 <tag/See also/
3571 <ref id="strcasecmp" name="strcasecmp">,
3572 <ref id="strcmp" name="strcmp">,
3573 <ref id="strcoll" name="strcoll">,
3574 <ref id="strncmp" name="strncmp">
3575 <tag/Example/None.
3576 </descrip>
3577 </quote>
3578
3579
3580 <sect1>strlen<label id="strlen"><p>
3581
3582 <quote>
3583 <descrip>
3584 <tag/Function/Return the length of a string.
3585 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3586 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
3587 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
3588 string to which s points, not including the terminating null byte.
3589 <tag/Limits/<itemize>
3590 <item>The function is only available as fastcall function, so it may only
3591 be used in presence of a prototype.
3592 <item>When compiling with <tt/-Os/ (inline known standard functions), the
3593 function does not work correctly for strings with more than 255 characters.
3594 </itemize>
3595 <tag/Availability/ISO 9899
3596 <tag/See also/
3597 <ref id="strcpy" name="strcpy">
3598 <tag/Example/None.
3599 </descrip>
3600 </quote>
3601
3602
3603 <sect1>strlower<label id="strlower"><p>
3604
3605 <quote>
3606 <descrip>
3607 <tag/Function/Make a string lower case.
3608 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3609 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
3610 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
3611 function to each character of a string. The function will always return <tt/s/.
3612 <tag/Limits/<itemize>
3613 <item>The function is only available as fastcall function, so it may only
3614 be used in presence of a prototype.
3615 <item>The function prototype is unavailable when compiling in strict ANSI mode.
3616 <item>An alias name for this function is <tt/strlwr/.
3617 </itemize>
3618 <tag/Availability/cc65
3619 <tag/See also/
3620 <ref id="strupper" name="strupper">,
3621 <ref id="tolower" name="tolower">
3622 <tag/Example/None.
3623 </descrip>
3624 </quote>
3625
3626
3627 <sect1>strlwr<label id="strlwr"><p>
3628
3629 <quote>
3630 See <tt/strlower/.
3631 </quote>
3632
3633
3634 <sect1>strncat<label id="strncat"><p>
3635
3636 <quote>
3637 <descrip>
3638 <tag/Function/Concatentate two strings.
3639 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3640 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
3641 <tag/Description/The <tt/strncat/ function appends not more than n characters
3642 of the string pointed to by s2 to the end of the string pointed to by s1. The
3643 terminating null character at the end of s1 is overwritten. A terminating null
3644 character is appended to the result, even if not all of s2 is appended to s1.
3645 <tag/Limits/<itemize>
3646 <item>The function is only available as fastcall function, so it may only
3647 be used in presence of a prototype.
3648 <item>If copying takes place between objects that overlap, the behavior
3649 is undefined.
3650 </itemize>
3651 <tag/Availability/ISO 9899
3652 <tag/See also/
3653 <ref id="strcpy" name="strcpy">,
3654 <ref id="strncat" name="strncat">,
3655 <ref id="strncpy" name="strncpy">
3656 <tag/Example/None.
3657 </descrip>
3658 </quote>
3659
3660
3661 <sect1>strncmp<label id="strncmp"><p>
3662
3663 <quote>
3664 <descrip>
3665 <tag/Function/Compare two strings.
3666 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3667 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
3668 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
3669 characters of the two strings passed as parameters. It returns a value that is
3670 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
3671 <tt/s2/, zero if they are identical, and a value greater than zero they are
3672 greater.
3673 <tag/Limits/<itemize>
3674 <item>The function is only available as fastcall function, so it may only
3675 be used in presence of a prototype.
3676 </itemize>
3677 <tag/Availability/ISO 9899
3678 <tag/See also/
3679 <ref id="strcasecmp" name="strcasecmp">,
3680 <ref id="strcmp" name="strcmp">,
3681 <ref id="strcoll" name="strcoll">,
3682 <ref id="stricmp" name="stricmp">
3683 <tag/Example/None.
3684 </descrip>
3685 </quote>
3686
3687
3688 <sect1>strncpy<label id="strncpy"><p>
3689
3690 <quote>
3691 <descrip>
3692 <tag/Function/Copy part of a string.
3693 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3694 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
3695 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
3696 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
3697 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
3698 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
3699 written. The function will always return <tt/s1/.
3700 <tag/Limits/<itemize>
3701 <item>The function is only available as fastcall function, so it may only
3702 be used in presence of a prototype. If there is no null byte in the first <tt/n/
3703 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
3704 <item>If copying takes place between objects that overlap, the behavior is
3705 undefined.
3706 </itemize>
3707 <tag/Availability/ISO 9899
3708 <tag/See also/
3709 <ref id="strcat" name="strcat">,
3710 <ref id="strcpy" name="strcpy">,
3711 <ref id="strncat" name="strncat">
3712 <tag/Example/
3713 <verb>
3714 #include <string.h>
3715
3716 static char hello[6];
3717
3718 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
3719 hello[5] = '\0';
3720 </verb>
3721 </descrip>
3722 </quote>
3723
3724
3725 <sect1>strrchr<label id="strrchr"><p>
3726
3727 <quote>
3728 <descrip>
3729 <tag/Function/Search for a character in a string.
3730 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3731 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
3732 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
3733 (converted to a char) in the string pointed to by <tt/s/. The terminating null
3734 byte is considered to be part of the string. Upon completion, the function
3735 returns a pointer to the byte, or a null pointer if the byte was not found.
3736 <tag/Limits/<itemize>
3737 <item>The function is only available as fastcall function, so it may only
3738 be used in presence of a prototype.
3739 </itemize>
3740 <tag/Availability/ISO 9899
3741 <tag/See also/
3742 <ref id="strchr" name="strchr">
3743 <tag/Example/None.
3744 </descrip>
3745 </quote>
3746
3747
3748 <sect1>strspn<label id="strspn"><p>
3749
3750 <quote>
3751 <descrip>
3752 <tag/Function/Compute the length of a substring.
3753 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3754 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
3755 <tag/Description/The <tt/strspn/ function computes and returns the length of
3756 the substring pointed to by <tt/s/ which does consist only of characters
3757 contained in the string <tt/set/.
3758 <tag/Limits/<itemize>
3759 <item>The function is only available as fastcall function, so it may only
3760 be used in presence of a prototype.
3761 </itemize>
3762 <tag/Availability/ISO 9899
3763 <tag/See also/
3764 <ref id="strcspn" name="strcspn">,
3765 <ref id="strstr" name="strstr">
3766 <tag/Example/None.
3767 </descrip>
3768 </quote>
3769
3770
3771 <sect1>strstr<label id="strstr"><p>
3772
3773 <quote>
3774 <descrip>
3775 <tag/Function/Find a substring.
3776 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3777 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
3778 <tag/Description/<tt/strstr/ searches for the first occurance of the string
3779 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
3780 otherwise it returns <tt/NULL/.
3781 <tag/Limits/<itemize>
3782 <item>The function is only available as fastcall function, so it may only
3783 be used in presence of a prototype.
3784 </itemize>
3785 <tag/Availability/ISO 9899
3786 <tag/See also/
3787 <ref id="strcspn" name="strcspn">,
3788 <ref id="strspn" name="strspn">
3789 <tag/Example/None.
3790 </descrip>
3791 </quote>
3792
3793
3794 <sect1>strupper<label id="strupper"><p>
3795
3796 <quote>
3797 <descrip>
3798 <tag/Function/Make a string upper case.
3799 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3800 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
3801 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
3802 function to each character of a string. The function will always return <tt/s/.
3803 <tag/Limits/<itemize>
3804 <item>The function is only available as fastcall function, so it may only
3805 be used in presence of a prototype.
3806 <item>The function prototype is unavailable when compiling in strict ANSI mode.
3807 <item>An alias name for this function is <tt/strupr/.
3808 </itemize>
3809 <tag/Availability/cc65
3810 <tag/See also/
3811 <ref id="strlower" name="strlower">
3812 <ref id="toupper" name="toupper">
3813 <tag/Example/None.
3814 </descrip>
3815 </quote>
3816
3817
3818 <sect1>strupr<label id="strupr"><p>
3819
3820 <quote>
3821 See <tt/strupper/.
3822 </quote>
3823
3824
3825 <sect1>textcolor<label id="textcolor"><p>
3826
3827 <quote>
3828 <descrip>
3829 <tag/Function/Set the text color.
3830 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3831 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
3832 <tag/Description/The function will set a new text color. It returns the old
3833 (current) text color. Text output using any <tt/conio.h/ function will use
3834 the color set by this function.
3835 <tag/Limits/<itemize>
3836 <item>Text colors are system dependent. The function may have no effect
3837 on systems where the text color cannot be changed.
3838 <item>The function is only available as fastcall function, so it may only
3839 be used in presence of a prototype.
3840 </itemize>
3841 <tag/Availability/cc65
3842 <tag/See also/
3843 <ref id="bgcolor" name="bgcolor">,
3844 <ref id="bordercolor" name="bordercolor">
3845 <tag/Example/None.
3846 </descrip>
3847 </quote>
3848
3849
3850 <sect1>time<label id="time"><p>
3851
3852 <quote>
3853 <descrip>
3854 <tag/Function/Get the time.
3855 <tag/Header/<tt/<ref id="time.h" name="time.h">/
3856 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
3857 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
3858 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
3859 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
3860 returned and <tt/errno/ is set to <tt/ENOSYS/.
3861 <tag/Limits/<itemize>
3862 <item>The function is only available as fastcall function, so it may
3863 only be used in presence of a prototype.
3864 <item>Many platforms supported by cc65 do not have a realtime clock, so the
3865 returned value may not be valid.
3866 </itemize>
3867 <tag/Availability/ISO 9899
3868 <tag/Example/None.
3869 </descrip>
3870 </quote>
3871
3872
3873 <sect1>toggle_videomode<label id="toggle_videomode"><p>
3874
3875 <quote>
3876 <descrip>
3877 <tag/Function/Toggle between 40 and 80 column mode.
3878 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3879 <tag/Declaration/<tt/void toggle_videomode (void);/
3880 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
3881 old mode (cursor position, color and so on) are saved and restored together
3882 with the mode.
3883 <tag/Limits/<itemize>
3884 <item>The function is specific to the C128.
3885 </itemize>
3886 <tag/Availability/C128
3887 <tag/See also/
3888 <ref id="fast" name="fast">,
3889 <ref id="slow" name="slow">
3890 <tag/Example/None.
3891 </descrip>
3892 </quote>
3893
3894
3895 <sect1>tolower<label id="tolower"><p>
3896
3897 <quote>
3898 <descrip>
3899 <tag/Function/Convert a character into its lower case representation.
3900 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3901 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
3902 <tag/Description/The function returns the given character converted to lower
3903 case. If the given character is not a letter, it is returned unchanged.
3904 <tag/Limits/<itemize>
3905 <item>The function is only available as fastcall function, so it may
3906 only be used in presence of a prototype.
3907 </itemize>
3908 <tag/Availability/ISO 9899
3909 <tag/See also/
3910 <ref id="islower" name="islower">,
3911 <ref id="isupper" name="isupper">,
3912 <ref id="toupper" name="toupper">
3913 <tag/Example/None.
3914 </descrip>
3915 </quote>
3916
3917
3918 <sect1>toupper<label id="toupper"><p>
3919
3920 <quote>
3921 <descrip>
3922 <tag/Function/Convert a character into its upper case representation.
3923 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3924 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
3925 <tag/Description/The function returns the given character converted to upper
3926 case. If the given character is not a letter, it is returned unchanged.
3927 <tag/Limits/<itemize>
3928 <item>The function is only available as fastcall function, so it may
3929 only be used in presence of a prototype.
3930 </itemize>
3931 <tag/Availability/ISO 9899
3932 <tag/See also/
3933 <ref id="islower" name="islower">,
3934 <ref id="isupper" name="isupper">,
3935 <ref id="tolower" name="tolower">
3936 <tag/Example/None.
3937 </descrip>
3938 </quote>
3939
3940
3941 <sect1>ultoa<label id="ultoa"><p>
3942
3943 <quote>
3944 <descrip>
3945 <tag/Function/Convert an unsigned long integer into a string.
3946 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3947 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
3948 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
3949 string using <tt/radix/ as the base.
3950 <tag/Limits/<itemize>
3951 <item>There are no provisions to prevent a buffer overflow.
3952 <item>The function is non standard, so it is not available in strict ANSI mode.
3953 You should probably use <tt/sprintf/ instead.
3954 <item>The function is only available as fastcall function, so it may only be
3955 used in presence of a prototype.
3956 </itemize>
3957 <tag/Availability/cc65
3958 <tag/See also/
3959 <ref id="atoi" name="atoi">,
3960 <ref id="atol" name="atol">,
3961 <ref id="itoa" name="itoa">,
3962 <ref id="ltoa" name="ltoa">,
3963 <ref id="utoa" name="utoa">
3964 <tag/Example/None.
3965 </descrip>
3966 </quote>
3967
3968
3969 <sect1>unlink<label id="unlink"><p>
3970
3971 <quote>
3972 <descrip>
3973 <tag/Function/Delete a file.
3974 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3975 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
3976 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
3977 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3978 code describing the reason for the failure.
3979 <tag/Limits/
3980 <itemize>
3981 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
3982 name="remove">/ instead, which is a native ANSI C function and does the same.
3983 <item>This function is not available on all cc65 targets (depends on the
3984 availability of file I/O).
3985 <item>The function is only available as fastcall function, so it may only
3986 be used in presence of a prototype.
3987 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
3988 used, which has the same semantics, but is more portable, because it conforms
3989 to the ISO C standard.
3990 </itemize>
3991 <tag/Availability/POSIX 1003.1
3992 <tag/See also/
3993 <ref id="remove" name="remove">
3994 <tag/Example/
3995 #include &lt;stdio.h&gt;
3996 #include &lt;unistd.h&gt;
3997
3998 #define FILENAME "helloworld"
3999
4000 if (unlink (FILENAME) == 0) {
4001     printf ("We deleted %s successfully\n", FILENAME);
4002 } else {
4003     printf ("There was a problem deleting %s\n", FILENAME);
4004 }
4005 </descrip>
4006 </quote>
4007
4008
4009 <sect1>utoa<label id="utoa"><p>
4010
4011 <quote>
4012 <descrip>
4013 <tag/Function/Convert an unsigned integer into a string.
4014 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4015 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
4016 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
4017 using <tt/radix/ as the base.
4018 <tag/Limits/<itemize>
4019 <item>There are no provisions to prevent a buffer overflow.
4020 <item>The function is non standard, so it is not available in strict ANSI mode.
4021 You should probably use <tt/sprintf/ instead.
4022 <item>The function is only available as fastcall function, so it may only be
4023 used in presence of a prototype.
4024 </itemize>
4025 <tag/Availability/cc65
4026 <tag/See also/
4027 <ref id="atoi" name="atoi">,
4028 <ref id="atol" name="atol">,
4029 <ref id="itoa" name="itoa">,
4030 <ref id="ltoa" name="ltoa">,
4031 <ref id="ultoa" name="ultoa">
4032 <tag/Example/None.
4033 </descrip>
4034 </quote>
4035
4036
4037 <sect1>vcprintf<label id="vcprintf"><p>
4038
4039 <quote>
4040 <descrip>
4041 <tag/Function/Formatted output to the console.
4042 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4043 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
4044 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
4045 text where necessary and formatted according to the format string given. The
4046 resulting string is output to the console. <tt/vcprintf/ supports the same
4047 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
4048 <tag/Limits/<itemize>
4049 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
4050 between <tt/\r/ and <tt/\n/.
4051 <item>The function is only available as fastcall function, so it may only be
4052 used in presence of a prototype.
4053 </itemize>
4054 <tag/Availability/cc65
4055 <tag/See also/
4056 <ref id="cprintf" name="cprintf">,
4057 <ref id="cputc" name="cputc">,
4058 <ref id="cputcxy" name="cputcxy">,
4059 <ref id="cputs" name="cputs">,
4060 <ref id="cputsxy" name="cputsxy">
4061 <tag/Example/None.
4062 </descrip>
4063 </quote>
4064
4065
4066 <sect1>wherex<label id="wherex"><p>
4067
4068 <quote>
4069 <descrip>
4070 <tag/Function/Return the current X position of the text mode cursor.
4071 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4072 <tag/Declaration/<tt/unsigned char wherex (void);/
4073 <tag/Description/The function returns the current X position of the text mode
4074 cursor. Zero is returned for the leftmost screen position.
4075 <tag/Availability/cc65
4076 <tag/See also/
4077 <ref id="gotox" name="gotox">,
4078 <ref id="gotoy" name="gotoy">,
4079 <ref id="gotoxy" name="gotoxy">,
4080 <ref id="wherey" name="wherey">
4081 <tag/Example/None.
4082 </descrip>
4083 </quote>
4084
4085
4086 <sect1>wherey<label id="wherey"><p>
4087
4088 <quote>
4089 <descrip>
4090 <tag/Function/Return the current Y position of the text mode cursor.
4091 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4092 <tag/Declaration/<tt/unsigned char wherey (void);/
4093 <tag/Description/The function returns the current Y position of the text mode
4094 cursor. Zero is returned for the uppermost screen position.
4095 <tag/Availability/cc65
4096 <tag/See also/
4097 <ref id="gotox" name="gotox">,
4098 <ref id="gotoy" name="gotoy">,
4099 <ref id="gotoxy" name="gotoxy">,
4100 <ref id="wherex" name="wherex">
4101 <tag/Example/None.
4102 </descrip>
4103 </quote>
4104
4105
4106 </article>
4107
4108