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