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