#ifndef COMPILE_H
/*
#define F2281_MEM1_05_ClearBytes                BCFCzCUCOZCPEZIRJVLS
#define F9010_MEM1_06_Allocate                  zzDFWCIUEZHFVDDK
#define F9013_MEM1_09_EmptyFunction             AOCUIXHRZLCI
#define F9011_MEM1_07_Free                      yzCUOZSc
#define F9012_MEM1_08_Available                 VUORE
#define F9015_MEM1_03_Expunge                   Rz
#define F7317_MEM1_04_CopyBytes                 A
*/
/* main */
/*
#define AllocMem                                WSZ4U
#define AvailMem                                Lz
#define FreeMem                                 Oz
#define F1065_SetExecBase                       MLKQSDDKSLDMOEF

extern void F2281_MEM1_05_ClearBytes();
extern unsigned char* F9010_MEM1_06_Allocate();
extern void F9013_MEM1_09_EmptyFunction();
extern void F9011_MEM1_07_Free();
extern long F9012_MEM1_08_Available();
extern void F9015_MEM1_03_Expunge();
extern void F7317_MEM1_04_CopyBytes();
*/
/* alpha0*/
/*
extern void F2281_MEM1_05_ClearBytes();
extern void F7317_MEM1_04_CopyBytes();
extern unsigned char* F9010_MEM1_06_Allocate();
extern void F9011_MEM1_07_Free();
extern long F9012_MEM1_08_Available();
extern void F9013_MEM1_09_EmptyFunction();
extern void F9015_MEM1_03_Expunge();
*/
/*
extern void main();
extern long AvailMem();
extern void FreeMem();
extern void F1065_SetExecBase();
extern void* AllocMem();
*/

/* OK to reorg segment # correctly
#define F2281_MEM1_05_ClearBytes                AAAAAAA000
#define F9010_MEM1_06_Allocate                  AAAAAAA001
#define F9013_MEM1_09_EmptyFunction             AAAAAAA002
#define F9011_MEM1_07_Free                      AAAAAAA003
#define F9012_MEM1_08_Available                 AAAAAAA004
#define F9015_MEM1_03_Expunge                   AAAAAAA005
#define F7317_MEM1_04_CopyBytes                 AAAAAAA006
*/
/* main */
/*
#define AllocMem                                AAAAAAA009
#define AvailMem                                AAAAAAA010
#define FreeMem                                 AAAAAAA011
#define F1065_SetExecBase                       AAAAAAA008

extern void F2281_MEM1_05_ClearBytes();
extern unsigned char* F9010_MEM1_06_Allocate();
extern void F9013_MEM1_09_EmptyFunction();
extern void F9011_MEM1_07_Free();
extern long F9012_MEM1_08_Available();
extern void F9015_MEM1_03_Expunge();
extern void F7317_MEM1_04_CopyBytes();
extern void main();
extern long AvailMem();
extern void FreeMem();
extern void F1065_SetExecBase();
extern void* AllocMem();
*/
/* Order in original A31E\MEM1.FTL
F0008_MAIN_ClearBytes
F9010_
F9013_
F9011_
F9012_
F9015_ExpungeMEM1
F0007_MAIN_CopyBytes
main
AllocMem
AvailMem
FreeMem
F1065_SetExecBase
*/
#define COMPILE_H

/* This file defines conditional compilation symbols for the specified version to compile */
/* If NOCOPYPROTECTION is defined (with parameter -D on the compiler command line, for example -DNOCOPYPROTECTION=1) then the program compiles without all copy protection related variables and code */

#ifdef __TURBOC__       /* If compiling on PC */
#define ANSI_COMPILER
#endif
#ifdef __HIGHC__        /* If compiling on FM-Towns */
#define ANSI_COMPILER
#endif
#ifdef THINK_C          /* If compiling on Macintosh (but not for Apple IIGS) */
#define ANSI_COMPILER
/* EXEID must be defined on the compiler command line except on Macintosh where there is no command line */
#include "EXEID.H"      /* There is a distinct folder for each executable containing a unique EXEID.H file that defines EXEID */
#endif

/* Executable types */
#define C01_SWOOSH     1
#define C02_LAUNCHER   2
#define C03_GAME       3
#define C04_SWITCH     4
#define C05_ANIM       5
#define C06_CEDT       6
#define C07_HINT       7
#define C08_LANG       8
#define C09_CNFG       9
#define C10_UNPACK    10
#define C11_SELECTOR  11
#define C12_FIO1      12
#define C13_GRF1      13
#define C14_INT1      14
#define C15_MEM1      15
#define C16_MUSC      16
#define C17_USIO      17
#define C18_VDEO      18
#define C19_NECIO     19
#define C20_NEC8      20
#define C21_NEC16     21
#define C22_IBMIO     22
#define C23_EGA       23
#define C24_TANDY     24
#define C25_VGA       25

/* Define other variables based on the value of EXEID */
#if EXEID == 0 /* A20E\BOOTSECT.BIN */
#define MEDIA 31 /* A20E */
#endif
#if EXEID == 1 /* A20E\dm */
#define MEDIA 31 /* A20E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 2 /* A20E\exec */
#define MEDIA 31 /* A20E */
#define EXETYPE C02_LAUNCHER
#endif
#if EXEID == 3 /* A20E\GRAPH21.BIN */
#define MEDIA 31 /* A20E */
#endif
#if EXEID == 4 /* A20E\GRAPH538.BIN */
#define MEDIA 31 /* A20E */
#endif
#if EXEID == 5 /* A20E\GRAPH548.BIN */
#define MEDIA 31 /* A20E */
#endif
#if EXEID == 6 /* A20E\ReadMe */
#define MEDIA 31 /* A20E */
#endif
#if EXEID == 7 /* A20E\swoosh */
#define MEDIA 31 /* A20E */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 8 /* A20ED\dm */
#define MEDIA 30 /* A20ED */
#define EXETYPE C03_GAME
#endif
#if EXEID == 9 /* A20ED\swoosh */
#define MEDIA 30 /* A20ED */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 10 /* A20F\dm */
#define MEDIA 32 /* A20F */
#define EXETYPE C03_GAME
#endif
#if EXEID == 11 /* A20F\swoosh */
#define MEDIA 32 /* A20F */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 12 /* A20G\dm */
#define MEDIA 33 /* A20G */
#define EXETYPE C03_GAME
#endif
#if EXEID == 13 /* A21E\dm */
#define MEDIA 34 /* A21E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 14 /* A21E\exec */
#define MEDIA 34 /* A21E */
#define EXETYPE C02_LAUNCHER
#endif
#if EXEID == 15 /* A21E\swoosh */
#define MEDIA 34 /* A21E */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 16 /* A22E\dm */
#define MEDIA 35 /* A22E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 17 /* A22G\dm */
#define MEDIA 36 /* A22G */
#define EXETYPE C03_GAME
#endif
#if EXEID == 18 /* A31E\ANIM.FTL */
#define MEDIA 37 /* A31E */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 19 /* A31E\APPA.FTL */
#define MEDIA 37 /* A31E */
#define EXETYPE C10_UNPACK
#endif
#if EXEID == 20 /* A31E\APPB.FTL */
#define MEDIA 37 /* A31E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 21 /* A31E\BJELoad_R */
#define MEDIA 37 /* A31E */
#define EXETYPE C02_LAUNCHER
#define NO_REDMCSB_DEFS
#endif
#if EXEID == 22 /* A31E\CNFG.FTL */
#define MEDIA 37 /* A31E */
#define EXETYPE C09_CNFG
#endif
#if EXEID == 23 /* A31E\GRAPH21.BIN */
#define MEDIA 37 /* A31E */
#endif
#if EXEID == 24 /* A31E\GRAPH676.BIN */
#define MEDIA 37 /* A31E */
#endif
#if EXEID == 25 /* A31E\GRF1.FTL */
#define MEDIA 37 /* A31E */
#define EXETYPE C13_GRF1
#endif
#if EXEID == 26 /* A31E\MEM1.FTL */
#define MEDIA 37 /* A31E */
#define EXETYPE C15_MEM1
#endif
#if EXEID == 27 /* A31E\SWSH.FTL */
#define MEDIA 37 /* A31E */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 28 /* A31E\USIO.FTL */
#define MEDIA 37 /* A31E */
#define EXETYPE C17_USIO
#endif
#if EXEID == 29 /* A31E\VDEO.FTL */
#define MEDIA 37 /* A31E */
#define EXETYPE C18_VDEO
#endif
#if EXEID == 30 /* A31M\APPA.FTL */
#define MEDIA 38 /* A31M */
#define EXETYPE C10_UNPACK
#endif
#if EXEID == 31 /* A31M\APPB.FTL */
#define MEDIA 38 /* A31M */
#define EXETYPE C08_LANG
#endif
#if EXEID == 32 /* A31M\GRF1.FTL */
#define MEDIA 38 /* A31M */
#define EXETYPE C13_GRF1
#endif
#if EXEID == 33 /* A31M\KAOS.FTL */
#define MEDIA 38 /* A31M */
#define EXETYPE C03_GAME
#endif
#if EXEID == 34 /* A31M\USIO.FTL */
#define MEDIA 38 /* A31M */
#define EXETYPE C17_USIO
#endif
#if EXEID == 35 /* A31M\VDEO.FTL */
#define MEDIA 38 /* A31M */
#define EXETYPE C18_VDEO
#endif
#if EXEID == 36 /* A33M\KAOS.FTL */
#define MEDIA 39 /* A33M */
#define EXETYPE C03_GAME
#endif
#if EXEID == 37 /* A35E\APPB.FTL */
#define MEDIA 40 /* A35E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 38 /* A35E\BJELoad_R */
#define MEDIA 40 /* A35E */
#define EXETYPE C02_LAUNCHER
#define NO_REDMCSB_DEFS
#endif
#if EXEID == 39 /* A35E\VDEO.FTL */
#define MEDIA 40 /* A35E */
#define EXETYPE C18_VDEO
#endif
#if EXEID == 40 /* A35M\KAOS.FTL */
#define MEDIA 48 /* A35M */
#define EXETYPE C03_GAME
#endif
#if EXEID == 41 /* A35M\ANIM.FTL */
#define MEDIA 48 /* A35M */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 42 /* A35M\APPB.FTL */
#define MEDIA 48 /* A35M */
#define EXETYPE C08_LANG
#endif
#if EXEID == 43 /* A36M\CNFG.FTL */
#define MEDIA 41 /* A36M */
#define EXETYPE C09_CNFG
#endif
#if EXEID == 44 /* A36M\KAOS.FTL */
#define MEDIA 41 /* A36M */
#define EXETYPE C03_GAME
#endif
#if EXEID == 45 /* AU1E\ANIM.FTL */
#define MEDIA 42 /* AU1E */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 46 /* AU1E\APPB.FTL */
#define MEDIA 42 /* AU1E */
#define EXETYPE C04_SWITCH
#endif
#if EXEID == 47 /* AU1E\CEDT.FTL */
#define MEDIA 42 /* AU1E */
#define EXETYPE C06_CEDT
#endif
#if EXEID == 48 /* AU1E\HINT.FTL */
#define MEDIA 42 /* AU1E */
#define EXETYPE C07_HINT
#endif
#if EXEID == 49 /* AU2F\ANIM.FTL */
#define MEDIA 45 /* AU2F */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 50 /* AU2F\APPB.FTL */
#define MEDIA 45 /* AU2F */
#define EXETYPE C04_SWITCH
#endif
#if EXEID == 51 /* AU2G\APPB.FTL */
#define MEDIA 46 /* AU2G */
#define EXETYPE C04_SWITCH
#endif
#if EXEID == 52 /* AU2E\APPA.FTL */
#define MEDIA 43 /* AU2E */
#define EXETYPE C10_UNPACK
#endif
#if EXEID == 53 /* AU2E\CEDT.FTL */
#define MEDIA 43 /* AU2E */
#define EXETYPE C06_CEDT
#endif
#if EXEID == 54 /* AU2E\FIO1.FTL */
#define MEDIA 43 /* AU2E */
#define EXETYPE C12_FIO1
#endif
#if EXEID == 55 /* AU2E\HINT.FTL */
#define MEDIA 43 /* AU2E */
#define EXETYPE C07_HINT
#endif
#if EXEID == 56 /* AU3E\CEDT.FTL */
#define MEDIA 44 /* AU3E */
#define EXETYPE C06_CEDT
#endif
#if EXEID == 57 /* F20M\EDM.EXP */
#define MEDIA 70 /* F20E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 58 /* F20M\JDM.EXP */
#define MEDIA 80 /* F20J */
#define EXETYPE C03_GAME
#endif
#if EXEID == 59 /* F31M\ANIMTW.EXP */
#define MEDIA 81 /* F31J */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 60 /* F31M\CHTWE.EXP */
#define MEDIA 71 /* F31E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 61 /* F31M\CHTWJ.EXP */
#define MEDIA 81 /* F31J */
#define EXETYPE C03_GAME
#endif
#if EXEID == 62 /* F31M\SWITCHTW.EXP */
#define MEDIA 81 /* F31J */
#define EXETYPE C04_SWITCH
#endif
#if EXEID == 63 /* F31M\UTILE.EXP */
#define MEDIA 71 /* F31E */
#define EXETYPE C06_CEDT
#endif
#if EXEID == 64 /* F31M\UTILJ.EXP */
#define MEDIA 81 /* F31J */
#define EXETYPE C06_CEDT
#endif
#if EXEID == 65 /* G14ED\DUNGEON.MASTER */
#define MEDIA 20 /* G14ED */
#define EXETYPE C03_GAME
#endif
#if EXEID == 66 /* G14ED\START */
#define MEDIA 20 /* G14ED */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 67 /* G20E\DUNGEON.MASTER */
#define MEDIA 21 /* G20E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 68 /* G20E\GRAPH21.BIN */
#define MEDIA 21 /* G20E */
#endif
#if EXEID == 69 /* G20E\START */
#define MEDIA 21 /* G20E */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 70 /* G21E\DUNGEON.MASTER */
#define MEDIA 22 /* G21E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 71 /* I34E\ANIM */
#define MEDIA 90 /* I34E */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 72 /* I34E\DM.EXE */
#define MEDIA 90 /* I34E */
#define EXETYPE C02_LAUNCHER
#endif
#if EXEID == 73 /* I34E\EGA */
#define MEDIA 90 /* I34E */
#define EXETYPE C23_EGA
#endif
#if EXEID == 74 /* I34E\FIRES */
#define MEDIA 90 /* I34E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 75 /* I34E\IBMIO */
#define MEDIA 90 /* I34E */
#define EXETYPE C22_IBMIO
#endif
#if EXEID == 76 /* I34E\INSTALL.EXE */
#define MEDIA 90 /* I34E */
#endif
#if EXEID == 77 /* I34E\SELECTOR */
#define MEDIA 90 /* I34E */
#define EXETYPE C11_SELECTOR
#endif
#if EXEID == 78 /* I34E\STATS.EXE */
#define MEDIA 90 /* I34E */
#endif
#if EXEID == 79 /* I34E\SWOOSH */
#define MEDIA 90 /* I34E */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 80 /* I34E\TANDY */
#define MEDIA 90 /* I34E */
#define EXETYPE C24_TANDY
#endif
#if EXEID == 81 /* I34E\VGA */
#define MEDIA 90 /* I34E */
#define EXETYPE C25_VGA
#endif
#if EXEID == 82 /* I34M\ANIM */
#define MEDIA 91 /* I34M */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 83 /* I34M\DM.EXE */
#define MEDIA 91 /* I34M */
#define EXETYPE C02_LAUNCHER
#endif
#if EXEID == 84 /* I34M\FIRES */
#define MEDIA 91 /* I34M */
#define EXETYPE C03_GAME
#endif
#if EXEID == 85 /* I34M\INSTALL.EXE */
#define MEDIA 91 /* I34M */
#endif
#if EXEID == 86 /* I34M\SELECTOR */
#define MEDIA 91 /* I34M */
#define EXETYPE C11_SELECTOR
#endif
#if EXEID == 87 /* P20JA\DMSTART3.EXE */
#define MEDIA 50 /* P20JA */
#define EXETYPE C02_LAUNCHER
#endif
#if EXEID == 88 /* P20JA\FIRES.EXE */
#define MEDIA 50 /* P20JA */
#define EXETYPE C03_GAME
#endif
#if EXEID == 89 /* P20JA\NEC16.EXE */
#define MEDIA 50 /* P20JA */
#define EXETYPE C21_NEC16
#endif
#if EXEID == 90 /* P20JA\NEC8.EXE */
#define MEDIA 50 /* P20JA */
#define EXETYPE C20_NEC8
#endif
#if EXEID == 91 /* P20JA\NECIO.EXE */
#define MEDIA 50 /* P20JA */
#define EXETYPE C19_NECIO
#endif
#if EXEID == 92 /* P20JB\DMSTART4.EXE */
#define MEDIA 51 /* P20JB */
#define EXETYPE C02_LAUNCHER
#endif
#if EXEID == 93 /* P20JB\FIRES */
#define MEDIA 51 /* P20JB */
#define EXETYPE C03_GAME
#endif
#if EXEID == 94 /* P20JB\NEC16 */
#define MEDIA 51 /* P20JB */
#define EXETYPE C21_NEC16
#endif
#if EXEID == 95 /* P20JB\NEC8 */
#define MEDIA 51 /* P20JB */
#define EXETYPE C20_NEC8
#endif
#if EXEID == 96 /* P20JB\NECIO */
#define MEDIA 51 /* P20JB */
#define EXETYPE C19_NECIO
#endif
#if EXEID == 97 /* P20JB\SWOOSH */
#define MEDIA 51 /* P20JB */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 98 /* P31J\ANIM */
#define MEDIA 52 /* P31J */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 99 /* P31J\CSB.EXE */
#define MEDIA 52 /* P31J */
#define EXETYPE C02_LAUNCHER
#endif
#if EXEID == 100 /* P31J\CSBGAME */
#define MEDIA 52 /* P31J */
#define EXETYPE C03_GAME
#endif
#if EXEID == 101 /* P31J\CSBUTIL */
#define MEDIA 52 /* P31J */
#define EXETYPE C06_CEDT
#endif
#if EXEID == 102 /* P31J\FIRES */
#define MEDIA 52 /* P31J */
#define EXETYPE C04_SWITCH
#endif
#if EXEID == 103 /* P31J\NEC16 */
#define MEDIA 52 /* P31J */
#define EXETYPE C21_NEC16
#endif
#if EXEID == 104 /* P31J\NEC8 */
#define MEDIA 52 /* P31J */
#define EXETYPE C20_NEC8
#endif
#if EXEID == 105 /* P31J\NECIO */
#define MEDIA 52 /* P31J */
#define EXETYPE C19_NECIO
#endif
#if EXEID == 106 /* S10EA\BOOTSECT.BIN */
#define MEDIA 10 /* S10EA */
#endif
#if EXEID == 107 /* S10EA\GRAPH21.BIN */
#define MEDIA 10 /* S10EA */
#endif
#if EXEID == 108 /* S10EA\GRAPH538.BIN */
#define MEDIA 10 /* S10EA */
#endif
#if EXEID == 109 /* S10EA\GRAPH548.BIN */
#define MEDIA 10 /* S10EA */
#endif
#if EXEID == 110 /* S10EA\START.PAK */
#define MEDIA 10 /* S10EA */
#define EXETYPE C03_GAME
#endif
#if EXEID == 111 /* S10EA\START.PRG */
#define MEDIA 10 /* S10EA */
#define EXETYPE C02_LAUNCHER
#endif
#if EXEID == 112 /* S10EA\SWOOSH.IMG */
#define MEDIA 10 /* S10EA */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 113 /* S10EB\START.PAK */
#define MEDIA 11 /* S10EB */
#define EXETYPE C03_GAME
#endif
#if EXEID == 114 /* S11E\START.PAK */
#define MEDIA 12 /* S11E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 115 /* S12E\START.PAK */
#define MEDIA 13 /* S12E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 116 /* S12G\START.PAK */
#define MEDIA 14 /* S12G */
#define EXETYPE C03_GAME
#endif
#if EXEID == 117 /* S13FA\START.PAK */
#define MEDIA 15 /* S13FA */
#define EXETYPE C03_GAME
#endif
#if EXEID == 118 /* S13FB\START.PAK */
#define MEDIA 16 /* S13FB */
#define EXETYPE C03_GAME
#endif
#if EXEID == 119 /* S20E\GRAPH21.BIN */
#define MEDIA 17 /* S20E */
#endif
#if EXEID == 120 /* S20E\START.PAK */
#define MEDIA 17 /* S20E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 121 /* S21E\START.PAK */
#define MEDIA 18 /* S21E */
#define EXETYPE C03_GAME
#endif
#if EXEID == 122 /* SDMP\DMPACK.TOS */
#define MEDIA 13 /* S12E */
#endif
#if EXEID == 123 /* SU1E\ANIMATE.FTL */
#define MEDIA 19 /* SU1E */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 124 /* SU1E\BOOTSECT.BIN */
#define MEDIA 19 /* SU1E */
#endif
#if EXEID == 125 /* SU1E\CHAOS.FTL */
#define MEDIA 19 /* SU1E */
#define EXETYPE C06_CEDT
#endif
#if EXEID == 126 /* SU1E\FTLCODE */
#define MEDIA 19 /* SU1E */
#define EXETYPE C04_SWITCH
#endif
#if EXEID == 127 /* SU1E\HINT.FTL */
#define MEDIA 19 /* SU1E */
#define EXETYPE C07_HINT
#endif
#if EXEID == 128 /* SU1E\START.PRG */
#define MEDIA 19 /* SU1E */
#define EXETYPE C02_LAUNCHER
#define NO_REDMCSB_DEFS
#endif
#if EXEID == 129 /* X30J\DM.X */
#define MEDIA 60 /* X30J */
#define EXETYPE C02_LAUNCHER
#define NO_REDMCSB_DEFS
#endif
#if EXEID == 130 /* X30J\FTLCODE */
#define MEDIA 60 /* X30J */
#define EXETYPE C03_GAME
#endif
#if EXEID == 131 /* X30J\SWOOSH */
#define MEDIA 60 /* X30J */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 132 /* X31J\ANIM.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C05_ANIM
#endif
#if EXEID == 133 /* X31J\APPA.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C10_UNPACK
#endif
#if EXEID == 134 /* X31J\APPB.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C04_SWITCH
#endif
#if EXEID == 135 /* X31J\CEDT.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C06_CEDT
#endif
#if EXEID == 136 /* X31J\CHAOS_ST.X */
#define MEDIA 61 /* X31J */
#define EXETYPE C02_LAUNCHER
#define NO_REDMCSB_DEFS
#endif
#if EXEID == 137 /* X31J\GRF1.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C13_GRF1
#endif
#if EXEID == 138 /* X31J\INT1.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C14_INT1
#endif
#if EXEID == 139 /* X31J\KAOS.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C03_GAME
#endif
#if EXEID == 140 /* X31J\MEM1.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C15_MEM1
#endif
#if EXEID == 141 /* X31J\MUSC.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C16_MUSC
#endif
#if EXEID == 142 /* X31J\SWSH.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C01_SWOOSH
#endif
#if EXEID == 143 /* X31J\USIO.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C17_USIO
#endif
#if EXEID == 144 /* X31J\VDEO.FTL */
#define MEDIA 61 /* X31J */
#define EXETYPE C18_VDEO
#endif
#if EXEID == 145 /* X31J\VIDSET.X */
#define MEDIA 61 /* X31J */
#define NO_REDMCSB_DEFS
#endif

#ifndef EXETYPE
#define EXETYPE -1
#endif


#include "MEDIA.H" /* The XC compiler on X68000 fails if there are too many #define directives. Two sets of directives are thus declared using the 'X68000' symbol that is automatically defined by XC */


#ifdef MEDIA108_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_SU1E
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
#include <STRING.H>
#endif
#ifdef THINK_C /* If compiling on Macintosh */
#include <stdarg.h>
#endif
#endif

#ifdef MEDIA426_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M_AU1E_AU2E_AU2F_AU2G_AU3E
#ifndef THINK_C /* Use header files supplied with compiler */
/* #include <fcntl.h> */
#include <exec/alerts.h>
#include <exec/memory.h>
#include <devices/audio.h>
#include <devices/gameport.h>
#include <devices/input.h>
#include <devices/inputevent.h>
#include <devices/keyboard.h>
#include <devices/trackdisk.h>
#include <graphics/gfxbase.h>
#include <graphics/gfxmacros.h>
#include <graphics/sprite.h>
#include <hardware/blit.h>
#include <hardware/cia.h>
#include <hardware/adkbits.h>
#include <intuition/intuitionbase.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <resources/disk.h>
/* #include <STRING.H> Aztec C does not have this file */
#endif
#ifdef THINK_C
#include "MACAMIGA.H" /* Use custom header file */
#include <stdarg.h>
#endif
#endif

#ifdef MEDIA607_X30J_X31J
#ifndef THINK_C
#include <DOSLIB.H>
#include <IOCSLIB.H>
#endif
#ifdef THINK_C
#include <stdarg.h>
#endif
#endif

#ifdef MEDIA459_P20JA_P20JB_P31J
#include <DOS.H>
#include <SETJMP.H>
#include <STDARG.H>
#include <STDIO.H>
#include <STDLIB.H>
#include <STRING.H>
#include <ALLOC.H>
#include <PROCESS.H>
#endif

#ifdef MEDIA707_I34E_I34M
#include <DOS.H>
#include <SETJMP.H>
#include <STDIO.H>
#include <STDLIB.H>
#include <STRING.H>
#include <ALLOC.H>
#endif

#ifdef MEDIA551_F20E_F20J_F31E_F31J
/* #include <SETJMP.H> Cannot include because of conflict on type jmp_buf */
#include <STDARG.H>
#include <STDIO.H>
#include <STDLIB.H>
#include <MOS.H>
#include <SND.H>
#include <EGB.H>
#include <CDRFRB.H>
#endif




#ifdef MEDIA707_I34E_I34M
#define PC_FIX_CODE_SIZE
#endif
/* If PC_FIX_CODE_SIZE is defined, then functions have the correct size but the program is incorrect (additional or missing instructions). Code is added/removed so that the size of functions is the same as in the original, so that final code has the same size and offsets as in the original program (facilitates text comparisons of disassembled code)
If PC_FIX_CODE_SIZE is not defined, then the program is correct but the code size is different */




#ifdef MEDIA000_S10EA
#define CHECKSUM_A 0xB9F1
#define CHECKSUM_B 0xE582
#define CHECKSUM_C 0x7C63
#define CHECKSUM_D 0xB1EB
#endif
#ifdef MEDIA217_S10EB
#define CHECKSUM_A 0x3C8F
#define CHECKSUM_B 0x06AB
#define CHECKSUM_C 0x5B3A
#define CHECKSUM_D 0x1895
#endif
#ifdef MEDIA222_S11E
#define CHECKSUM_A 0x2FF3
#define CHECKSUM_B 0x9FCB
#define CHECKSUM_C 0x5ABC
#define CHECKSUM_D 0x1913
#endif
#ifdef MEDIA234_S12E
#define CHECKSUM_A 0xD815
#define CHECKSUM_B 0x0432
#define CHECKSUM_C 0xF661
#define CHECKSUM_D 0xE14D
#endif
#ifdef MEDIA252_S12G
#define CHECKSUM_A 0x2E51
#define CHECKSUM_B 0xFCBF
#define CHECKSUM_C 0xFE95
#define CHECKSUM_D 0xD919
#endif
#ifdef MEDIA256_S13FA_S13FB
#define CHECKSUM_A 0x35D5
#define CHECKSUM_B 0xE630
#define CHECKSUM_C 0x1526
#define CHECKSUM_D 0xE9B7
#endif
#ifdef MEDIA264_S20E
#define CHECKSUM_A 0x396C
#define CHECKSUM_B 0x3177
#define CHECKSUM_C 0x3648
#define CHECKSUM_D 0xEF78
#endif
#ifdef MEDIA340_S21E
#define CHECKSUM_A 0xC0F8
#define CHECKSUM_B 0x02A3
#define CHECKSUM_C 0x6628
#define CHECKSUM_D 0xBF98
#endif
#ifdef MEDIA349_G14ED
#define NOCOPYPROTECTION
#endif
#ifdef MEDIA388_G20E_G21E
#define CHECKSUM_A 0x9DCC
#define CHECKSUM_C 0x62F7
#define CHECKSUM_D 0x9D88
#define CHECKSUM_E 0x46F2
#define CHECKSUM_F 0x6B78
#define CHECKSUM_G 0x2F8E
#define CHECKSUM_H 0x6CCD
#define CHECKSUM_I 0xEEDA
#define CHECKSUM_J 0x5828
#define CHECKSUM_K 0xD0F1
#define CHECKSUM_L 0x93B2
#define CHECKSUM_M 0xC0EA
#endif
#ifdef MEDIA410_A20ED
#define NOCOPYPROTECTION
#endif
#ifdef MEDIA432_A20E
#define CHECKSUM_A 0x578B
#define CHECKSUM_B 0x4C20
#define CHECKSUM_C 0x2E43
#define CHECKSUM_D 0x88E7
#endif
#ifdef MEDIA443_A20F
#define CHECKSUM_A 0x3EDB
#define CHECKSUM_B 0x3E19
#define CHECKSUM_C 0x2731
#define CHECKSUM_D 0x8FF9
#endif
#ifdef MEDIA445_A20G
#define CHECKSUM_A 0x94AB
#define CHECKSUM_B 0x404D
#define CHECKSUM_C 0x2499
#define CHECKSUM_D 0x9291
#endif
#ifdef MEDIA447_A21E
#define CHECKSUM_A 0xED2B
#define CHECKSUM_B 0x4D34
#define CHECKSUM_C 0x2321
#define CHECKSUM_D 0x9409
#endif
#ifdef MEDIA454_A22E
#define CHECKSUM_A 0xED2B
#define CHECKSUM_B 0x4D34
#define CHECKSUM_C 0x2321
#define CHECKSUM_D 0x9409
#endif
#ifdef MEDIA456_A22G
#define CHECKSUM_A 0x94AB
#define CHECKSUM_B 0x404D
#define CHECKSUM_C 0x2499
#define CHECKSUM_D 0x9291
#endif
#ifdef MEDIA618_A31E
#define CHECKSUM_A 0xF845
#define CHECKSUM_B 0x2575
#define CHECKSUM_C 0xBCB7
#define CHECKSUM_D 0xBCB7
#endif
#ifdef MEDIA655_A31M
#define CHECKSUM_A 0x899D
#define CHECKSUM_B 0x3131
#define CHECKSUM_C 0xECC7
#define CHECKSUM_D 0xECC7
#endif
#ifdef MEDIA665_A33M
#define CHECKSUM_A 0x5238
#define CHECKSUM_B 0x8E88
#define CHECKSUM_C 0x4CAC
#define CHECKSUM_D 0x4CAC
#endif
#ifdef MEDIA739_A35E
#define CHECKSUM_A 0xD043
#define CHECKSUM_B 0xCBF4
#define CHECKSUM_C 0x4CBA
#define CHECKSUM_D 0x4CBA
#endif
#ifdef MEDIA742_A35M
#define CHECKSUM_A 0x443F
#define CHECKSUM_B 0x5711
#define CHECKSUM_C 0x843F
#define CHECKSUM_D 0x843F
#endif

#define FUNC_DEF
#define FUNC_DECL
#define STATICFUNCTION static
#define STATICGLOBAL static

#ifndef ANSI_COMPILER
#define SEPARATOR       ;
#define FINAL_SEPARATOR ;
#endif
#ifdef ANSI_COMPILER
#define SEPARATOR       ,
#define FINAL_SEPARATOR )
#endif

#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
#define REGISTER        /* PC, PC-98 and FM-Towns */
#endif
/* Amiga: '#define REGISTER register' is already in types.h */
#ifndef REGISTER        /* Atari ST, X68000 and Apple IIGS (register keyword is ignored on Apple IIGS) */
#define REGISTER register
#endif

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
#define HUGE huge
#endif
#ifndef HUGE
#define HUGE
#endif

#ifdef MEDIA174_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_SU1E
#ifndef THINK_C
#define void int  /* There is no void type in Megamax C. It is not possible to declare a function with no return value */
                  /* This fake void type is used only to clearly indicate functions that do not return any value */
#endif
#endif

#ifndef NULL
#define NULL 0L /* Null pointer. Defined in Aztec C and Turbo C but not in Megamax C */
#endif

#ifdef MEDIA543_F20E_F20J_X30J_F31E_F31J_X31J
#ifndef THINK_C
#define int16_t short
#endif
#endif
#ifndef int16_t
#define int16_t int
#endif

#ifndef BOOLEAN
#define BOOLEAN int16_t /* There is no boolean type in Megamax C, Aztec C and Turbo C. This fake BOOLEAN type is used for variables of type int whose values are only tested as being 0 (false) or non zero (true) */
#endif
#define C0_FALSE 0
#define C1_TRUE  1

#ifdef THINK_C /* If compiling on Macintosh */
#define ASM_STUB_PREFIX\
        asm {\
                move.l  a5,-(sp)        /* Backup A5 value of caller */\
                movea.l 12(a0),a5       /* Restore base.FTLLibrary.FTLExecutable.A5World to access the data segment of the FTL executable */\
        }
#define ASM_STUB_SUFFIX\
        asm {\
                movea.l (sp)+,a5        /* Restore A5 value of caller */\
        }
#endif

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
#define ASM_STUB_PREFIX\
        asm     push    ds                              /* Backup DS value of caller */;\
        asm     mov     ax, cs:V0000000_DataSegment     /* Restore access to the data segment of the driver */;\
        asm     mov     ds, ax
#define ASM_STUB_SUFFIX\
        asm     pop     ds                              /* Restore DS value of caller */
#endif

#ifdef MEDIA332_S20E_S21E_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define SAVE_HEADER CSB_SAVE_HEADER
#endif
#ifndef SAVE_HEADER
#define SAVE_HEADER DM_SAVE_HEADER
#endif

#ifdef MEDIA087_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_SU1E
#define CHAMPION CHAMPION_INCLUDING_PORTRAIT
#endif
#ifndef CHAMPION
#define CHAMPION CHAMPION_EXCLUDING_PORTRAIT
#endif

#ifdef MEDIA106_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_X30J_P20JA_P20JB_I34E_I34M_X31J_P31J
#define FILE_HANDLE int
#endif
#ifdef MEDIA426_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M_AU1E_AU2E_AU2F_AU2G_AU3E
#define FILE_HANDLE struct FileHandle*
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#define FILE_HANDLE FILE*
#endif

#define M000_INDEX_TO_ORDINAL(value) ((value) + 1)
#define M001_ORDINAL_TO_INDEX(value) ((value) - 1)

#define M007_GET(value, mask)    ((value) & (mask))
#define M008_SET(value, mask)    ((value) |= (mask))
#define M010_TOGGLE(value, mask) ((value) ^= (mask))
#define M009_CLEAR(value, mask)  ((value) &= ~(mask))
#define M727_CLEAR(value, mask)  ((value) &= (unsigned int16_t)(~(mask)))



#ifdef MEDIA615_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_AU1E_AU2E_AU2F_AU2G_AU3E
#include "PRIM.H"
#endif
#ifdef MEDIA772_SU1E
#include "PRIM.H"
#endif

#ifndef NO_REDMCSB_DEFS
#include "DEFS.H"
#endif
#endif
