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