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