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