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