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