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