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