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