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