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