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