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