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