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