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