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