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