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