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