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