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