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