1 /*****************************************************************************/
5 /* Direct console I/O */
9 /* (C) 1998-2000 Ullrich von Bassewitz */
11 /* D-70597 Stuttgart */
12 /* EMail: uz@musoftware.de */
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. */
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: */
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 */
32 /*****************************************************************************/
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.
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,
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.
57 #if !defined(_STDARG_H)
61 /* Include the correct machine specific file */
62 #if defined(__CBM__) && !defined(_CBM_H)
64 #elif defined(__APPLE2__) && !defined(_APPLE2_H)
66 #elif defined(__ATARI__) && !defined(_ATARI_H)
72 /*****************************************************************************/
74 /*****************************************************************************/
79 /* Clear the whole screen and put the cursor into the top left corner */
81 unsigned char kbhit (void);
82 /* Return true if there's a key waiting, return false if not */
84 void __fastcall__ gotox (unsigned char x);
85 /* Set the cursor to the specified X position, leave the Y position untouched */
87 void __fastcall__ gotoy (unsigned char y);
88 /* Set the cursor to the specified Y position, leave the X position untouched */
90 void __fastcall__ gotoxy (unsigned char x, unsigned char y);
91 /* Set the cursor to the specified position */
93 unsigned char wherex (void);
94 /* Return the X position of the cursor */
96 unsigned char wherey (void);
97 /* Return the Y position of the cursor */
99 void __fastcall__ cputc (char c);
100 /* Output one character at the current cursor position */
102 void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
103 /* Same as "gotoxy (x, y); cputc (c);" */
105 void __fastcall__ cputs (const char* s);
106 /* Output a NUL terminated string at the current cursor position */
108 void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);
109 /* Same as "gotoxy (x, y); puts (s);" */
111 int cprintf (const char* format, ...);
112 /* Like printf, but uses direct screen I/O */
114 int __fastcall__ vcprintf (const char* format, va_list ap);
115 /* Like vprintf, but uses direct screen I/O */
118 /* Return a character from the keyboard. If there is no character available,
119 * the functions waits until the user does press a key. If cursor is set to
120 * 1 (see below), a blinking cursor is displayed while waiting.
123 unsigned char __fastcall__ cursor (unsigned char onoff);
124 /* If onoff is 1, a cursor is display when waiting for keyboard input. If
125 * onoff is 0, the cursor is hidden when waiting for keyboard input. The
126 * function returns the old cursor setting.
129 unsigned char __fastcall__ revers (unsigned char onoff);
130 /* Enable/disable reverse character display. This may not be supported by
131 * the output device. Return the old setting.
134 unsigned char __fastcall__ textcolor (unsigned char color);
135 /* Set the color for text output. The old color setting is returned. */
137 unsigned char __fastcall__ bgcolor (unsigned char color);
138 /* Set the color for the background. The old color setting is returned. */
140 unsigned char __fastcall__ bordercolor (unsigned char color);
141 /* Set the color for the border. The old color setting is returned. */
143 void __fastcall__ chline (unsigned char length);
144 /* Output a horizontal line with the given length starting at the current
148 void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);
149 /* Same as "gotoxy (x, y); chline (length);" */
151 void __fastcall__ cvline (unsigned char length);
152 /* Output a vertical line with the given length at the current cursor
156 void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);
157 /* Same as "gotoxy (x, y); cvline (length);" */
159 void __fastcall__ cclear (unsigned char length);
160 /* Clear part of a line (write length spaces). */
162 void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);
163 /* Same as "gotoxy (x, y); cclear (length);" */
165 void __fastcall__ screensize (unsigned char* x, unsigned char* y);
166 /* Return the current screen size. */
168 void __fastcall__ cputhex8 (unsigned char val);
169 void __fastcall__ cputhex16 (unsigned val);
170 /* These shouldn't be here... */