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