1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 15:29:46 +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

@ -90,6 +90,27 @@
#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

@ -45,6 +45,12 @@
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Additional key defines */ /* Additional key defines */
#define CH_F1 224 #define CH_F1 224
#define CH_F2 225 #define CH_F2 225
@ -67,12 +73,33 @@
#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 */
/*****************************************************************************/
/* Special routines to read/write bytes and words in the system bank */ /* Special routines to read/write bytes and words in the system bank */
@ -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

@ -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 */
@ -45,12 +45,16 @@
/*****************************************************************************/
/* 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)
@ -61,6 +65,22 @@
/*****************************************************************************/
/* 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
/* End of pet.h */ /* End of pet.h */
#endif #endif