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