From: cuz Date: Sat, 26 Mar 2005 17:20:27 +0000 (+0000) Subject: Allow to replace the color functions in conio.h by macros for platforms X-Git-Tag: V2.12.0~417 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5363f9bee3e1e15fa40864b55dbbf759dbaf8752;p=cc65 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 --- diff --git a/include/apple2.h b/include/apple2.h index 175df71d8..eeda7bac4 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -1,32 +1,32 @@ /*****************************************************************************/ -/* */ -/* apple2.h */ -/* */ -/* Apple ][ system specific definitions */ -/* */ -/* */ -/* */ -/* (C) 2000 Kevin Ruland, */ -/* (C) 2003 Ullrich von Bassewitz, */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* apple2.h */ +/* */ +/* Apple ][ system specific definitions */ +/* */ +/* */ +/* */ +/* (C) 2000 Kevin Ruland, */ +/* (C) 2003 Ullrich von Bassewitz, */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* 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, */ /* 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 */ /* claim that you wrote the original software. If you use this software */ /* 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 */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -54,45 +54,66 @@ * used to get the library to compile correctly. They should not be used * in user code */ -#define COLOR_BLACK 0x00 -#define COLOR_WHITE 0x01 +#define COLOR_BLACK 0x00 +#define COLOR_WHITE 0x01 /* Characters codes */ -#define CH_ENTER 0x0D -#define CH_ESC 0x1B -#define CH_CURS_LEFT 0x08 -#define CH_CURS_RIGHT 0x15 - -#define CH_ULCORNER '+' -#define CH_URCORNER '+' -#define CH_LLCORNER '+' -#define CH_LRCORNER '+' -#define CH_TTEE '+' -#define CH_BTEE '+' -#define CH_LTEE '+' -#define CH_RTEE '+' -#define CH_CROSS '+' +#define CH_ENTER 0x0D +#define CH_ESC 0x1B +#define CH_CURS_LEFT 0x08 +#define CH_CURS_RIGHT 0x15 + +#define CH_ULCORNER '+' +#define CH_URCORNER '+' +#define CH_LLCORNER '+' +#define CH_LRCORNER '+' +#define CH_TTEE '+' +#define CH_BTEE '+' +#define CH_LTEE '+' +#define CH_RTEE '+' +#define CH_CROSS '+' /* Return codes for get_ostype */ #define APPLE_UNKNOWN 0x00 -#define APPLE_II 0x10 /* Apple ][ */ -#define APPLE_IIPLUS 0x11 /* Apple ][+ */ -#define APPLE_IIIEM 0x20 /* Apple /// (emulation) */ -#define APPLE_IIE 0x30 /* Apple //e */ -#define APPLE_IIEENH 0x31 /* Apple //e (enhanced) */ -#define APPLE_IIECARD 0x40 /* Apple //e Option Card */ -#define APPLE_IIC 0x50 /* Apple //c */ -#define APPLE_IIC35 0x51 /* Apple //c (3.5 ROM) */ -#define APPLE_IICEXP 0x53 /* Apple //c (Mem. Exp.) */ -#define APPLE_IICREV 0x54 /* Apple //c (Rev. Mem. Exp.) */ -#define APPLE_IICPLUS 0x55 /* Apple //c Plus */ -#define APPLE_IIGS 0x80 /* Apple IIgs */ -#define APPLE_IIGS1 0x81 /* Apple IIgs (ROM 1) */ -#define APPLE_IIGS3 0x83 /* Apple IIgs (ROM 3) */ +#define APPLE_II 0x10 /* Apple ][ */ +#define APPLE_IIPLUS 0x11 /* Apple ][+ */ +#define APPLE_IIIEM 0x20 /* Apple /// (emulation) */ +#define APPLE_IIE 0x30 /* Apple //e */ +#define APPLE_IIEENH 0x31 /* Apple //e (enhanced) */ +#define APPLE_IIECARD 0x40 /* Apple //e Option Card */ +#define APPLE_IIC 0x50 /* Apple //c */ +#define APPLE_IIC35 0x51 /* Apple //c (3.5 ROM) */ +#define APPLE_IICEXP 0x53 /* Apple //c (Mem. Exp.) */ +#define APPLE_IICREV 0x54 /* Apple //c (Rev. Mem. Exp.) */ +#define APPLE_IICPLUS 0x55 /* Apple //c Plus */ +#define APPLE_IIGS 0x80 /* Apple IIgs */ +#define APPLE_IIGS1 0x81 /* Apple IIgs (ROM 1) */ +#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); /* 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 */ diff --git a/include/cbm610.h b/include/cbm610.h index d3a37d977..e1b4a9df8 100644 --- a/include/cbm610.h +++ b/include/cbm610.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* cbm610.h */ +/* cbm610.h */ /* */ -/* CBM610 system specific definitions */ +/* CBM610 system specific definitions */ /* */ /* */ /* */ @@ -45,33 +45,60 @@ -/* Additional key defines */ -#define CH_F1 224 -#define CH_F2 225 -#define CH_F3 226 -#define CH_F4 227 -#define CH_F5 228 -#define CH_F6 229 -#define CH_F7 230 -#define CH_F8 231 -#define CH_F9 232 -#define CH_F10 233 -#define CH_F11 234 -#define CH_F12 235 -#define CH_F13 236 -#define CH_F14 237 -#define CH_F15 238 -#define CH_F16 239 -#define CH_F17 240 -#define CH_F18 241 -#define CH_F19 242 -#define CH_F20 243 +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + +/* Additional key defines */ +#define CH_F1 224 +#define CH_F2 225 +#define CH_F3 226 +#define CH_F4 227 +#define CH_F5 228 +#define CH_F6 229 +#define CH_F7 230 +#define CH_F8 231 +#define CH_F9 232 +#define CH_F10 233 +#define CH_F11 234 +#define CH_F12 235 +#define CH_F13 236 +#define CH_F14 237 +#define CH_F15 238 +#define CH_F16 239 +#define CH_F17 240 +#define CH_F18 241 +#define CH_F19 242 +#define CH_F20 243 /* Color defines */ -#define COLOR_BLACK 0x00 -#define COLOR_WHITE 0x01 +#define COLOR_BLACK 0x00 +#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 */ -#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) +/* 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 diff --git a/include/conio.h b/include/conio.h index 4a7bd0eb7..300a3be6f 100644 --- a/include/conio.h +++ b/include/conio.h @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2004 Ullrich von Bassewitz */ +/* (C) 1998-2005 Ullrich von Bassewitz */ /* Römerstraße 52 */ /* D-70794 Filderstadt */ /* 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 */ #endif diff --git a/include/pet.h b/include/pet.h index 79abbb82a..3ad4dd190 100644 --- a/include/pet.h +++ b/include/pet.h @@ -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 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -45,19 +45,39 @@ -/* Color defines */ -#define COLOR_BLACK 0x00 -#define COLOR_WHITE 0x01 +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ +/* Color defines */ +#define COLOR_BLACK 0x00 +#define COLOR_WHITE 0x01 + /* Define hardware */ #include <_pia.h> -#define PIA1 (*(struct __pia*)0xE810) -#define PIA2 (*(struct __pia*)0xE820) +#define PIA1 (*(struct __pia*)0xE810) +#define PIA2 (*(struct __pia*)0xE820) #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