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