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