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