1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

Allow to replace the color functions in conio.h by macros for platforms

where these functions are dummies anyway.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3422 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2005-03-26 17:20:27 +00:00
parent 071c58bda2
commit 5363f9bee3
4 changed files with 200 additions and 105 deletions

View File

@ -1,32 +1,32 @@
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* apple2.h */ /* apple2.h */
/* */ /* */
/* Apple ][ system specific definitions */ /* Apple ][ system specific definitions */
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2000 Kevin Ruland, <kevin@rodin.wustl.edu> */ /* (C) 2000 Kevin Ruland, <kevin@rodin.wustl.edu> */
/* (C) 2003 Ullrich von Bassewitz, <uz@cc65.org> */ /* (C) 2003 Ullrich von Bassewitz, <uz@cc65.org> */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */ /* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */ /* arising from the use of this software. */
/* */ /* */
/* Permission is granted to anyone to use this software for any purpose, */ /* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */ /* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */ /* freely, subject to the following restrictions: */
/* */ /* */
/* 1. The origin of this software must not be misrepresented; you must not */ /* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */ /* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */ /* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */ /* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */ /* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */ /* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */ /* 3. This notice may not be removed or altered from any source */
/* distribution. */ /* distribution. */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
@ -44,7 +44,7 @@
/*****************************************************************************/ /*****************************************************************************/
/* Data */ /* Data */
/*****************************************************************************/ /*****************************************************************************/
@ -54,45 +54,66 @@
* used to get the library to compile correctly. They should not be used * used to get the library to compile correctly. They should not be used
* in user code * in user code
*/ */
#define COLOR_BLACK 0x00 #define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01 #define COLOR_WHITE 0x01
/* Characters codes */ /* Characters codes */
#define CH_ENTER 0x0D #define CH_ENTER 0x0D
#define CH_ESC 0x1B #define CH_ESC 0x1B
#define CH_CURS_LEFT 0x08 #define CH_CURS_LEFT 0x08
#define CH_CURS_RIGHT 0x15 #define CH_CURS_RIGHT 0x15
#define CH_ULCORNER '+' #define CH_ULCORNER '+'
#define CH_URCORNER '+' #define CH_URCORNER '+'
#define CH_LLCORNER '+' #define CH_LLCORNER '+'
#define CH_LRCORNER '+' #define CH_LRCORNER '+'
#define CH_TTEE '+' #define CH_TTEE '+'
#define CH_BTEE '+' #define CH_BTEE '+'
#define CH_LTEE '+' #define CH_LTEE '+'
#define CH_RTEE '+' #define CH_RTEE '+'
#define CH_CROSS '+' #define CH_CROSS '+'
/* Return codes for get_ostype */ /* Return codes for get_ostype */
#define APPLE_UNKNOWN 0x00 #define APPLE_UNKNOWN 0x00
#define APPLE_II 0x10 /* Apple ][ */ #define APPLE_II 0x10 /* Apple ][ */
#define APPLE_IIPLUS 0x11 /* Apple ][+ */ #define APPLE_IIPLUS 0x11 /* Apple ][+ */
#define APPLE_IIIEM 0x20 /* Apple /// (emulation) */ #define APPLE_IIIEM 0x20 /* Apple /// (emulation) */
#define APPLE_IIE 0x30 /* Apple //e */ #define APPLE_IIE 0x30 /* Apple //e */
#define APPLE_IIEENH 0x31 /* Apple //e (enhanced) */ #define APPLE_IIEENH 0x31 /* Apple //e (enhanced) */
#define APPLE_IIECARD 0x40 /* Apple //e Option Card */ #define APPLE_IIECARD 0x40 /* Apple //e Option Card */
#define APPLE_IIC 0x50 /* Apple //c */ #define APPLE_IIC 0x50 /* Apple //c */
#define APPLE_IIC35 0x51 /* Apple //c (3.5 ROM) */ #define APPLE_IIC35 0x51 /* Apple //c (3.5 ROM) */
#define APPLE_IICEXP 0x53 /* Apple //c (Mem. Exp.) */ #define APPLE_IICEXP 0x53 /* Apple //c (Mem. Exp.) */
#define APPLE_IICREV 0x54 /* Apple //c (Rev. Mem. Exp.) */ #define APPLE_IICREV 0x54 /* Apple //c (Rev. Mem. Exp.) */
#define APPLE_IICPLUS 0x55 /* Apple //c Plus */ #define APPLE_IICPLUS 0x55 /* Apple //c Plus */
#define APPLE_IIGS 0x80 /* Apple IIgs */ #define APPLE_IIGS 0x80 /* Apple IIgs */
#define APPLE_IIGS1 0x81 /* Apple IIgs (ROM 1) */ #define APPLE_IIGS1 0x81 /* Apple IIgs (ROM 1) */
#define APPLE_IIGS3 0x83 /* Apple IIgs (ROM 3) */ #define APPLE_IIGS3 0x83 /* Apple IIgs (ROM 3) */
extern unsigned char _dos_type;
/* Valid _dos_type values:
*
* AppleDOS 3.3 - 0x00
* ProDOS 8 1.0.1 - 0x10
* ProDOS 8 1.0.2 - 0x10
* ProDOS 8 1.1.1 - 0x11
* ProDOS 8 1.2 - 0x12
* ProDOS 8 1.3 - 0x13
* ProDOS 8 1.4 - 0x14
* ProDOS 8 1.5 - 0x15
* ProDOS 8 1.6 - 0x16
* ProDOS 8 1.7 - 0x17
* ProDOS 8 1.8 - 0x18
* ProDOS 8 1.9 - 0x18
* ProDOS 8 2.0.1 - 0x21
* ProDOS 8 2.0.2 - 0x22
* ProDOS 8 2.0.3 - 0x23
*/
/*****************************************************************************/ /*****************************************************************************/
/* Code */ /* Code */
/*****************************************************************************/ /*****************************************************************************/
@ -100,6 +121,14 @@
unsigned char get_ostype (void); unsigned char get_ostype (void);
/* Get the machine type. Returns one of the APPLE_xxx codes. */ /* Get the machine type. Returns one of the APPLE_xxx codes. */
/* The following #defines will cause the matching functions calls in conio.h
* to be overlaid by macros with the same names, saving the function call
* overhead.
*/
#define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK
/* End of apple2.h */ /* End of apple2.h */

View File

@ -1,8 +1,8 @@
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* cbm610.h */ /* cbm610.h */
/* */ /* */
/* CBM610 system specific definitions */ /* CBM610 system specific definitions */
/* */ /* */
/* */ /* */
/* */ /* */
@ -45,33 +45,60 @@
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Additional key defines */ /* Additional key defines */
#define CH_F1 224 #define CH_F1 224
#define CH_F2 225 #define CH_F2 225
#define CH_F3 226 #define CH_F3 226
#define CH_F4 227 #define CH_F4 227
#define CH_F5 228 #define CH_F5 228
#define CH_F6 229 #define CH_F6 229
#define CH_F7 230 #define CH_F7 230
#define CH_F8 231 #define CH_F8 231
#define CH_F9 232 #define CH_F9 232
#define CH_F10 233 #define CH_F10 233
#define CH_F11 234 #define CH_F11 234
#define CH_F12 235 #define CH_F12 235
#define CH_F13 236 #define CH_F13 236
#define CH_F14 237 #define CH_F14 237
#define CH_F15 238 #define CH_F15 238
#define CH_F16 239 #define CH_F16 239
#define CH_F17 240 #define CH_F17 240
#define CH_F18 241 #define CH_F18 241
#define CH_F19 242 #define CH_F19 242
#define CH_F20 243 #define CH_F20 243
/* Color defines */ /* Color defines */
#define COLOR_BLACK 0x00 #define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01 #define COLOR_WHITE 0x01
/* Define hardware */
#include <_6545.h>
#define CRTC (*(struct __6545)0xD800)
#include <_sid.h>
#define SID (*(struct __sid*)0xDA00)
#include <_6526.h>
#define CIA (*(struct __cia*)0xDC00)
#include <_6551.h>
#define ACIA (*(struct __6551*)0xDD00)
#include <_6525.h>
#define TPI1 (*(struct __6525*)0xDE00)
#define TPI2 (*(struct __6525*)0xDF00)
/*****************************************************************************/
/* Code */
/*****************************************************************************/
@ -98,22 +125,13 @@ void __fastcall__ pokewsys (unsigned addr, unsigned val);
/* Define hardware */ /* The following #defines will cause the matching functions calls in conio.h
#include <_6545.h> * to be overlaid by macros with the same names, saving the function call
#define CRTC (*(struct __6545)0xD800) * overhead.
*/
#include <_sid.h> #define _textcolor(color) COLOR_WHITE
#define SID (*(struct __sid*)0xDA00) #define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK
#include <_6526.h>
#define CIA (*(struct __cia*)0xDC00)
#include <_6551.h>
#define ACIA (*(struct __6551*)0xDD00)
#include <_6525.h>
#define TPI1 (*(struct __6525*)0xDE00)
#define TPI2 (*(struct __6525*)0xDF00)

View File

@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2004 Ullrich von Bassewitz */ /* (C) 1998-2005 Ullrich von Bassewitz */
/* Römerstraße 52 */ /* Römerstraße 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@ -191,6 +191,34 @@ void __fastcall__ cputhex16 (unsigned val);
/*****************************************************************************/
/* 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.
*/
#if defined(_textcolor)
# define textcolor(x) _textcolor(x)
#endif
#if defined(_bgcolor)
# define bgcolor(x) _bgcolor(x)
#endif
#if defined(_bordercolor)
# define bordercolor(x) _bordercolor(x)
#endif
/* End of conio.h */ /* End of conio.h */
#endif #endif

View File

@ -1,12 +1,12 @@
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* pet.h */ /* pet.h */
/* */ /* */
/* PET system specific definitions */ /* PET system specific definitions */
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2004 Ullrich von Bassewitz */ /* (C) 1998-2005 Ullrich von Bassewitz */
/* Römerstraße 52 */ /* Römerstraße 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@ -45,19 +45,39 @@
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Color defines */ /* Color defines */
#define COLOR_BLACK 0x00 #define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01 #define COLOR_WHITE 0x01
/* Define hardware */ /* Define hardware */
#include <_pia.h> #include <_pia.h>
#define PIA1 (*(struct __pia*)0xE810) #define PIA1 (*(struct __pia*)0xE810)
#define PIA2 (*(struct __pia*)0xE820) #define PIA2 (*(struct __pia*)0xE820)
#include <_6522.h> #include <_6522.h>
#define VIA (*(struct __6522*)0xE840) #define VIA (*(struct __6522*)0xE840)
/*****************************************************************************/
/* Code */
/*****************************************************************************/
/* The following #defines will cause the matching functions calls in conio.h
* to be overlaid by macros with the same names, saving the function call
* overhead.
*/
#define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK