// JoeyLib platform, CPU, endian, and capability defines. // // Exactly one JOEYLIB_PLATFORM_* must be defined per build. The build // system normally sets this via -D; if absent, the header attempts to // auto-detect from compiler-predefined macros. #ifndef JOEYLIB_PLATFORM_H #define JOEYLIB_PLATFORM_H // ----- Auto-detect platform from compiler macros if not preset ----- #if !defined(JOEYLIB_PLATFORM_IIGS) && \ !defined(JOEYLIB_PLATFORM_AMIGA) && \ !defined(JOEYLIB_PLATFORM_ATARIST) && \ !defined(JOEYLIB_PLATFORM_DOS) #if defined(__DJGPP__) || defined(__MSDOS__) #define JOEYLIB_PLATFORM_DOS #elif defined(__amigaos__) || defined(AMIGA) || defined(__amigaos4__) #define JOEYLIB_PLATFORM_AMIGA #elif defined(__atarist__) || defined(__MINT__) || defined(__TOS__) #define JOEYLIB_PLATFORM_ATARIST #elif defined(__ORCAC__) || defined(__APPLE2GS__) || defined(__GNO__) #define JOEYLIB_PLATFORM_IIGS #else #error "JoeyLib: unknown platform; define JOEYLIB_PLATFORM_ explicitly via -D" #endif #endif // ----- Validate exactly one platform is defined ----- #if (defined(JOEYLIB_PLATFORM_IIGS) + \ defined(JOEYLIB_PLATFORM_AMIGA) + \ defined(JOEYLIB_PLATFORM_ATARIST) + \ defined(JOEYLIB_PLATFORM_DOS)) != 1 #error "JoeyLib: exactly one JOEYLIB_PLATFORM_* must be defined" #endif // ----- Derived CPU markers ----- #if defined(JOEYLIB_PLATFORM_IIGS) #define JOEYLIB_CPU_65816 #define JOEYLIB_ENDIAN_LITTLE #define JOEYLIB_NATIVE_CHUNKY #define JOEYLIB_PLATFORM_NAME "Apple IIgs" #elif defined(JOEYLIB_PLATFORM_AMIGA) #define JOEYLIB_CPU_68000 #define JOEYLIB_ENDIAN_BIG #define JOEYLIB_NATIVE_PLANAR #define JOEYLIB_HAS_BLITTER #define JOEYLIB_HAS_COPPER #define JOEYLIB_PLATFORM_NAME "Commodore Amiga" #elif defined(JOEYLIB_PLATFORM_ATARIST) #define JOEYLIB_CPU_68000 #define JOEYLIB_ENDIAN_BIG #define JOEYLIB_NATIVE_PLANAR #define JOEYLIB_PLATFORM_NAME "Atari ST" #elif defined(JOEYLIB_PLATFORM_DOS) #define JOEYLIB_CPU_X86 #define JOEYLIB_ENDIAN_LITTLE #define JOEYLIB_NATIVE_CHUNKY #define JOEYLIB_PLATFORM_NAME "MS-DOS" #endif // ----- ORCA-C named load segments ----- // // On the IIgs the ORCA Linker fits each load segment in its own bank, // so spilling cross-platform .c files into named segments is the way // to keep monolithic IIgs binaries under the 64 KB-per-bank _ROOT // limit. The `segment "name";` statement is ORCA-C-specific syntax // (see ORCA/C ch. 30); other ports' compilers don't recognize it, so // the macro evaluates to nothing on Amiga/ST/DOS. #ifdef JOEYLIB_PLATFORM_IIGS #define JOEYLIB_SEGMENT(name) segment name; #else #define JOEYLIB_SEGMENT(name) #endif // ----- Library version ----- #define JOEYLIB_VERSION_MAJOR 1 #define JOEYLIB_VERSION_MINOR 0 #define JOEYLIB_VERSION_PATCH 0 #define JOEYLIB_VERSION_STRING "1.0.0" #endif