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