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