X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fconio.h;h=72421af86ac7d8742706fbaadba50e08b116760d;hb=df80d071e8eeb799bd1d8ec55acd1ee92714c752;hp=cb7037e9f3131860fdcf4a7e009cf0ef2645a0f2;hpb=e967591be1b92db79ead0a689e604feaa08ba635;p=cc65 diff --git a/include/conio.h b/include/conio.h index cb7037e9f..72421af86 100644 --- a/include/conio.h +++ b/include/conio.h @@ -1,15 +1,15 @@ /*****************************************************************************/ /* */ -/* conio.h */ +/* conio.h */ /* */ -/* Direct console I/O */ +/* Direct console I/O */ /* */ /* */ /* */ -/* (C) 1998-2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1998-2007 Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -34,18 +34,18 @@ /* - * This is the direct console interface for cc65. I do not like the function - * names very much, but the first version started as a rewrite of Borlands - * conio, and, even if the interface has changed, the names did not. - * - * The interface does direct screen I/O, so it is fast enough for most - * programs. I did not implement text windows, since many applications do - * not need them and should not pay for the additional overhead. It should - * be easy to add text windows on a higher level if needed, - * - * Most routines do not check the parameters. This may be unfortunate but is - * also related to speed. The coordinates are always 0/0 based. - */ +** This is the direct console interface for cc65. I do not like the function +** names very much, but the first version started as a rewrite of Borland's +** conio, and, even if the interface has changed, the names did not. +** +** The interface does direct screen I/O, so it is fast enough for most +** programs. I did not implement text windows, since many applications do +** not need them and should not pay for the additional overhead. It should +** be easy to add text windows on a higher level if needed, +** +** Most routines do not check the parameters. This may be unfortunate but is +** also related to speed. The coordinates are always 0/0 based. +*/ @@ -54,27 +54,13 @@ -#if !defined(_STDARG_H) -# include -#endif - -/* Include the correct machine specific file */ -#if defined(__APPLE2__) && !defined(_APPLE2_H) -# include -#elif defined(__ATARI__) && !defined(_ATARI_H) -# include -#elif defined(__ATMOS__) && !defined(_ATMOS_H) -# include -#elif defined(__CBM__) && !defined(_CBM_H) -# include -#elif defined(__NES__) && !defined(_NES_H) -# include -#endif +#include +#include /*****************************************************************************/ -/* Functions */ +/* Functions */ /*****************************************************************************/ @@ -107,33 +93,56 @@ void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c); /* Same as "gotoxy (x, y); cputc (c);" */ void __fastcall__ cputs (const char* s); -/* Output a NUL terminated string at the current cursor position */ +/* Output a NUL-terminated string at the current cursor position */ void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s); /* Same as "gotoxy (x, y); puts (s);" */ int cprintf (const char* format, ...); -/* Like printf, but uses direct screen I/O */ +/* Like printf(), but uses direct screen output */ int __fastcall__ vcprintf (const char* format, va_list ap); -/* Like vprintf, but uses direct screen I/O */ +/* Like vprintf(), but uses direct screen output */ char cgetc (void); /* Return a character from the keyboard. If there is no character available, - * the functions waits until the user does press a key. If cursor is set to - * 1 (see below), a blinking cursor is displayed while waiting. - */ +** the function waits until the user does press a key. If cursor is set to +** 1 (see below), a blinking cursor is displayed while waiting. +*/ + +int cscanf (const char* format, ...); +/* Like scanf(), but uses direct keyboard input */ + +int __fastcall__ vcscanf (const char* format, va_list ap); +/* Like vscanf(), but uses direct keyboard input */ + +char cpeekc (void); +/* Return the character from the current cursor position */ + +unsigned char cpeekcolor (void); +/* Return the color from the current cursor position */ + +unsigned char cpeekrevers (void); +/* Return the reverse attribute from the current cursor position. +** If the character is reversed, then return 1; return 0 otherwise. +*/ + +void __fastcall__ cpeeks (char* s, unsigned int length); +/* Return a string of the characters that start at the current cursor position. +** Put the string into the buffer to which "s" points. The string will have +** "length" characters, then will be '\0'-terminated. +*/ unsigned char __fastcall__ cursor (unsigned char onoff); -/* If onoff is 1, a cursor is display when waiting for keyboard input. If - * onoff is 0, the cursor is hidden when waiting for keyboard input. The - * function returns the old cursor setting. - */ +/* If onoff is 1, a cursor is displayed when waiting for keyboard input. If +** onoff is 0, the cursor is hidden when waiting for keyboard input. The +** function returns the old cursor setting. +*/ unsigned char __fastcall__ revers (unsigned char onoff); /* Enable/disable reverse character display. This may not be supported by - * the output device. Return the old setting. - */ +** the output device. Return the old setting. +*/ unsigned char __fastcall__ textcolor (unsigned char color); /* Set the color for text output. The old color setting is returned. */ @@ -146,16 +155,16 @@ unsigned char __fastcall__ bordercolor (unsigned char color); void __fastcall__ chline (unsigned char length); /* Output a horizontal line with the given length starting at the current - * cursor position. - */ +** cursor position. +*/ void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length); /* Same as "gotoxy (x, y); chline (length);" */ void __fastcall__ cvline (unsigned char length); /* Output a vertical line with the given length at the current cursor - * position. - */ +** position. +*/ void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length); /* Same as "gotoxy (x, y); cvline (length);" */ @@ -175,8 +184,36 @@ void __fastcall__ cputhex16 (unsigned val); -/* End of conio.h */ +/*****************************************************************************/ +/* Macros */ +/*****************************************************************************/ + + + +/* On some platforms, functions are not available or are dummys. To suppress +** the call to these functions completely, the platform header files may +** define macros for these functions that start with an underline. If such a +** macro exists, a new macro is defined here, that expands to the one with the +** underline. The reason for this two stepped approach is that it is sometimes +** necessary to take the address of the function, which is not possible when +** using a macro. Since the function prototype is still present, #undefining +** the macro will give access to the actual function. +*/ + +#ifdef _textcolor +# define textcolor(x) _textcolor(x) +#endif +#ifdef _bgcolor +# define bgcolor(x) _bgcolor(x) +#endif +#ifdef _bordercolor +# define bordercolor(x) _bordercolor(x) +#endif +#ifdef _cpeekcolor +# define cpeekcolor(x) _cpeekcolor(x) #endif +/* End of conio.h */ +#endif