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