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