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