]> git.sur5r.net Git - cc65/blob - include/conio.h
vcprintf() does now have __fastcall__ calling conventions
[cc65] / include / conio.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                  conio.h                                  */
4 /*                                                                           */
5 /*                            Direct console I/O                             */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2000 Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 /*
37  * This is the direct console interface for cc65. I do not like the function
38  * names very much, but the first version started as a rewrite of Borlands
39  * conio, and, even if the interface has changed, the names did not.
40  *
41  * The interface does direct screen I/O, so it is fast enough for most
42  * programs. I did not implement text windows, since many applications do
43  * not need them and should not pay for the additional overhead. It should
44  * be easy to add text windows on a higher level if needed,
45  *
46  * Most routines do not check the parameters. This may be unfortunate but is
47  * also related to speed. The coordinates are always 0/0 based.
48  */
49
50
51
52 #ifndef _CONIO_H
53 #define _CONIO_H
54
55
56
57 #ifndef _STDARG_H
58 #  include <stdarg.h>
59 #endif
60
61 /* Read the CBM file if we're compiling for a CBM machine */
62 #ifdef __CBM__
63 #  ifndef _CBM_H
64 #    include <cbm.h>
65 #  endif
66 #endif
67
68 #ifdef __APPLE2__
69 #  ifndef _APPLE2_H
70 #    include <apple2.h>
71 #  endif
72 #endif
73
74 #ifdef __ATARI__
75 #  ifndef _ATARI_H
76 #    include <atari.h>
77 #  endif
78 #endif
79
80
81
82 /*****************************************************************************/
83 /*                                 Functions                                 */
84 /*****************************************************************************/
85
86
87
88 void clrscr (void);
89 /* Clear the whole screen and put the cursor into the top left corner */
90
91 unsigned char kbhit (void);
92 /* Return true if there's a key waiting, return false if not */
93
94 void __fastcall__ gotox (unsigned char x);
95 /* Set the cursor to the specified X position, leave the Y position untouched */
96
97 void __fastcall__ gotoy (unsigned char y);
98 /* Set the cursor to the specified Y position, leave the X position untouched */
99
100 void __fastcall__ gotoxy (unsigned char x, unsigned char y);
101 /* Set the cursor to the specified position */
102
103 unsigned char wherex (void);
104 /* Return the X position of the cursor */
105
106 unsigned char wherey (void);
107 /* Return the Y position of the cursor */
108
109 void __fastcall__ cputc (char c);
110 /* Output one character at the current cursor position */
111
112 void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
113 /* Same as "gotoxy (x, y); cputc (c);" */
114
115 void __fastcall__ cputs (const char* s);
116 /* Output a NUL terminated string at the current cursor position */
117
118 void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);
119 /* Same as "gotoxy (x, y); puts (s);" */
120
121 int cprintf (const char* format, ...);
122 /* Like printf, but uses direct screen I/O */
123
124 int __fastcall__ vcprintf (const char* format, va_list ap);
125 /* Like vprintf, but uses direct screen I/O */
126
127 char cgetc (void);
128 /* Return a character from the keyboard. If there is no character available,
129  * the functions waits until the user does press a key. If cursor is set to
130  * 1 (see below), a blinking cursor is displayed while waiting.
131  */
132
133 unsigned char __fastcall__ cursor (unsigned char onoff);
134 /* If onoff is 1, a cursor is display when waiting for keyboard input. If
135  * onoff is 0, the cursor is hidden when waiting for keyboard input. The
136  * function returns the old cursor setting.
137  */
138
139 unsigned char __fastcall__ revers (unsigned char onoff);
140 /* Enable/disable reverse character display. This may not be supported by
141  * the output device. Return the old setting.
142  */
143
144 unsigned char __fastcall__ textcolor (unsigned char color);
145 /* Set the color for text output. The old color setting is returned. */
146
147 unsigned char __fastcall__ bgcolor (unsigned char color);
148 /* Set the color for the background. The old color setting is returned. */
149
150 unsigned char __fastcall__ bordercolor (unsigned char color);
151 /* Set the color for the border. The old color setting is returned. */
152
153 void __fastcall__ chline (unsigned char length);
154 /* Output a horizontal line with the given length starting at the current
155  * cursor position.
156  */
157
158 void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);
159 /* Same as "gotoxy (x, y); chline (length);" */
160
161 void __fastcall__ cvline (unsigned char length);
162 /* Output a vertical line with the given length at the current cursor
163  * position.
164  */
165
166 void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);
167 /* Same as "gotoxy (x, y); cvline (length);" */
168
169 void __fastcall__ cclear (unsigned char length);
170 /* Clear part of a line (write length spaces). */
171
172 void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);
173 /* Same as "gotoxy (x, y); cclear (length);" */
174
175 void __fastcall__ screensize (unsigned char* x, unsigned char* y);
176 /* Return the current screen size. */
177
178 void __fastcall__ cputhex8 (unsigned char val);
179 void __fastcall__ cputhex16 (unsigned val);
180 /* These shouldn't be here... */
181
182
183
184 /* End of conio.h */
185 #endif
186
187
188