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