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