#ifdef MEDIA426_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M_AU1E_AU2E_AU2F_AU2G_AU3E
#ifndef AMIGA_H
#define AMIGA_H

#include "AMIGAINC.H"

typedef struct {
        long ByteCount;
        unsigned char* FirstSample;
} SOUND_DATA_AMIGA;

typedef struct { /* Size 34 bytes */
        struct Message BaseMessage;
        int16_t ScrollCommand;
        struct RastPort* RastPort;
        long* LogicalScreenBase;
        struct BitMap* BitMap;
} TEXT_SCROLLER_MESSAGE;

struct Text_Scroller { /* Size 42 bytes */
        void (*EntryPoint)();             /* Pointer to a function returning void */
        BOOLEAN IsScrolling;
        struct Task* Task;
        char* TaskName;
        TEXT_SCROLLER_MESSAGE* MyMessage;
        struct MsgPort* MsgPortMom;
        char* PortNameMom;
        struct MsgPort* MsgPortKid;
        char* PortNameKid;
        long Priority;
        ULONG StackSize;
};

typedef struct {
/* Graphics data */
#ifdef MEDIA427_A20ED_A20E_A20F_A20G_A22G
        struct BitMap* ScreenBitMap;
#endif
        struct BitMap* HatchBoxBitMap;
        unsigned int16_t* BlitterTemporaryBitplane;
#ifdef MEDIA448_A21E_A22E
        struct View* ViewBeforeGame;
#endif
        struct View GameView;
#ifdef MEDIA427_A20ED_A20E_A20F_A20G_A22G
        struct View* ViewBeforeGame;
#endif
        struct ViewPort ViewPort;
        struct RasInfo RasInfo;
        struct RastPort RastPort;
#ifdef MEDIA448_A21E_A22E
        struct BitMap* ScreenBitMap;
#endif
        struct UCopList* CopperList;
        long* ScreenBuffer;
/* Audio Data */
        struct Device* AudioDevice;
        struct IOAudio* Sound1LeftChannel;
        struct IOAudio* Sound1RightChannel;
        struct IOAudio* Sound1Control;
        struct MsgPort* IOAudio1ReplyPort;
        struct MsgPort* IOAudio2ReplyPort;
        struct MsgPort* IOAudio3ReplyPort;
        int16_t PendingSound1Index;
        struct IOAudio* Sound2LeftChannel;
        struct IOAudio* Sound2RightChannel;
        struct IOAudio* Sound2Control;
        struct MsgPort* IOAudio4ReplyPort;
        struct MsgPort* IOAudio5ReplyPort;
        struct MsgPort* IOAudio6ReplyPort;
        int16_t PendingSound2Index;
        unsigned char* SwooshSoundData;                 /* 36234 bytes buffer */
        char AllocatedUnits;                            /* Unused */
        char Unreferenced1;
/* Disk Data */
        struct IOExtTD* IOExtTD;
        struct MsgPort* IOExtTDReplyPort;
        APTR TrackBuffer;                               /* 5632 bytes buffer to store a track of 11 sectors of 512 bytes */
        struct MiscResource* DiskResource;
        struct DiscResourceUnit* DiscResourceUnit;
        struct MsgPort* DiscResourceUnitReplyPort;
/* Memory Data */
        long NotEnoughRAM;                              /* Value 0 or 1 */
        unsigned char Unreferenced2[8];
} AMIGA_DATA; /* Size = 292 bytes */

struct ExecMessage {
        struct Message sm_Message;
        AMIGA_DATA* AmigaData;
        BPTR DOSBase;
}; /* Size 28 bytes */

typedef struct {
        UWORD posctl[2];   /* used by simple sprite machine */
        UWORD data[18][2]; /* actual sprite image */
        UWORD reserved[2]; /* initialized to 0x0, 0x0 */
} SPRITEIMAGE;

typedef struct { /* Size 724 = 0x2D4 */
        char FileInfoBlockBuffer[264];              /* Enough space to fit a "struct FileInfoBlock" (size = 260 bytes) aligned on an address that is a multiple of 4 bytes */
        unsigned int16_t i108_ai_InputKeyFIFOBuffer[64];
        unsigned int16_t _aui_Palette_0x188[32];
        unsigned int16_t _aui_Palette_Intermediate[32];
        unsigned int16_t _aui_Palette_0x208[32];
        struct RastPort _RastPort;
        struct BitMap _BitMap;
} AMISTRUCT;

typedef struct { /* Size = 16 bytes */
        long _0x00;
        long _0x04_;
        UWORD* _0x08_cprlistStart;
        struct cprlist* _0x0C_cprlist;
} COPPERSTRUCT;

typedef struct { /* Size = 414 bytes = 0x19E */
        struct MsgPort MsgPort;
        long MsgPortName[4];
        struct View _0x032_View;
        struct ViewPort _0x44_ViewPort;
        struct RasInfo _0x6C_RasInfo;
        struct BitMap _0x078_Bitmap;
        struct RastPort _0x0A0_RastPort;
        struct View* _0x104_View;
        struct Screen* _0x108_Screen;
        struct Window* _0x10C_Window;
        COPPERSTRUCT _ps_0x110;
        COPPERSTRUCT _ps_0x120;
        unsigned char (*ColorComponentIncrements)[16];
        char** _puc_0x134_Buffer32320Bytes;                     /* Buffer of 32320 bytes */
        unsigned int16_t* _ps_0x138_BlitterTemporaryBitplane;
        struct SimpleSprite _0x13C_SimpleSprite;
        UWORD _0x148_SpriteImage[6];                            /* Sprite with 1 line only (includes 2 reserved words before and 2 reserved after) */
        int16_t _ai_0x154[36];                                  /* Sprite with 18 lines (without reserved words before and after) */
#ifdef MEDIA756_A36M_A31M_A33M_A35E_A35M_AU2E_AU2G_AU3E
        int16_t _0x19C;
#endif
} DRIA_Video;


#define M091_BITPLANE_SIZE(width, height) (((width) / 8) * height)
#define M092_BLITSIZE(width, height) (((height) << 6) | (width))

#define MASK0x0040_UNKNOWN  0x0040

#define MASK0x5555_MFM_DATA_BITS 0x5555

/* Mouse pointer types */
#define C0_POINTER_TYPE_ARROW         0
#define C1_POINTER_TYPE_OBJECT_ICON   1
#define C2_POINTER_TYPE_CHAMPION_ICON 2
#define C3_POINTER_TYPE_HAND          3
#define C4_POINTER_TYPE_AUTOSELECT    4

#ifndef NOCOPYPROTECTION
extern char G3171_c_ReadingCopyProtectionSector_CPSX;
#endif
extern unsigned char* SysBase;
/*extern unsigned char* _savsp;*/
/*extern unsigned char* DOSBase;*/
extern long G1000_l_ScreenWordCount;
extern unsigned char* G1002_puc_ViewportSourceBitPlane0;
extern unsigned char* G1003_puc_ViewportSourceBitPlane1;
extern unsigned char* G1004_puc_ViewportSourceBitPlane2;
extern unsigned char* G1005_puc_ViewportSourceBitPlane3;
extern unsigned char* G1006_puc_ViewportDestinationBitPlane0;
extern unsigned char* G1007_puc_ViewportDestinationBitPlane1;
extern unsigned char* G1008_puc_ViewportDestinationBitPlane2;
extern unsigned char* G1009_puc_ViewportDestinationBitPlane3;
/*extern unsigned int16_t* G1010_pui_DungeonViewCurrentPalette;*/
extern unsigned char G1012_auc_Frame_Ceiling[8];
extern unsigned char G1013_auc_Frame_Floor[8];
extern long G1014_l_AvailableFastMemoryByteCount;
extern unsigned char* G1015_puc_AllocatedFastMemory;
extern unsigned int16_t G1016_aui_Palette_FadeTemporary[16];
extern unsigned int16_t* G0731_pui_Palette_FadeFrom;
extern long G1018_l_AvailableChipMemoryByteCount;
extern unsigned char* G1019_puc_AvailableGEMMemoryBottom;
extern long G1020_l_AvailableGEMMemoryByteCount;
extern unsigned char* G1021_puc_AvailableChipMemoryBottom;
extern AMIGA_DATA* G0734_ps_AmigaData;
extern struct DiscResourceUnit* G1053_ps_DiscResourceUnit_CPSX;
extern struct MiscResource* G1054_ps_DiskResource_CPSX;
extern unsigned int16_t G1055_aui_Palette_Swoosh[16];
extern struct BitMap* G1056_ps_MessageAreaNewRowBitMap;
extern struct Text_Scroller G1057_s_TextScroller;
extern unsigned int16_t* G1058_pui_Palette_MousePointer;
extern char* G1060_pc_GameDiskVolumeName;
extern char* G1061_pc_SaveDiskVolumeName;
extern char* G1062_pc_SavedGameFileName;
extern char* G1063_pc_SavedGameBackupFileName;
extern int16_t G1065_ai_Box1[4];
extern int16_t G1066_ai_Box2[4];
extern int16_t G1067_ai_Box3[4];
extern int16_t G1074_ai_IconGraphicHeight[7];
extern struct Interrupt* G1080_ps_Interrupt_CPSX;
extern long G1084_l_GameDiskChangeVerticalBlankCount;
extern long G1085_l_SaveDiskChangeVerticalBlankCount;
extern unsigned long G1086_VerticalBlankCount;
extern struct InfoData* G1087_ps_VolumeInfoData;
extern struct RastPort* G1105_ps_RastPort;
extern struct BitMap* G1106_ps_BitMap_NewMessageLine;
extern struct Interrupt* G1110_ps_Interrupt_CPSX;
extern struct Interrupt* G1113_ps_Interrupt;
extern unsigned int16_t G1131_aui_Palette_MousePointer[16];
extern BOOLEAN G1147_B_LoadBonusDungeon;
extern long G1148_l_MemorySize;

extern int16_t G1075_ai_Box_Title_Dungeon_Chaos[4];
extern int16_t G1076_ai_Box_Entrance_DoorsUpperHalf[4];
extern int16_t G1133_ai_Box_Entrance_DoorsLowerHalf[4];
extern unsigned char G1025_auc_PaletteChanges_MousePointerObjectIconShadow[16];
extern DRIA_Video* G3191_ps_MsgPort_FTL_DRIA_Video;
extern unsigned int16_t G3197_pui_ColorPalette[16];

extern unsigned int16_t* G3198_pui_PaletteColor16To31;
extern unsigned int16_t* G3123_PaletteSourceForMiddleScreen;
extern unsigned int16_t* G3119_pui_ColorPalette_SourceForTopAndBottomScreen;
extern unsigned int16_t* G3206_;


extern BOOLEAN G3199_B_UpdatePaletteColor16To31InVerticalBlank;
extern BOOLEAN G3121_B_UpdateMiddleScreenPaletteInNextVerticalBlank;
extern BOOLEAN G3127_B_UpdateTopAndBottomScreenPaletteInNextVerticalBlank;
extern int16_t G3207_B_AllowPaletteAndMessageAreaUpdatesInVerticalBlank;


extern unsigned char* G3153_puc_A5Backup;
extern struct MsgPort* G3155_ps_MsgPort;
extern struct IOStdReq* G3156_ps_IOStdReq_Console;
extern struct IOStdReq* G1034_ps_IOStdReq;
extern struct MsgPort* G3158_ps_MsgPort1;
extern BOOLEAN G3157_B_InputDeviceAllocated;
extern BOOLEAN G3164_B_;
extern unsigned char* G3162_;
extern unsigned char* G3163_;
extern unsigned char* G3169_puc_ChipMemoryBlock1Bottom;
extern unsigned char* G3170_puc_FastMemoryBlockBottom;
#ifdef MEDIA618_A31E
extern unsigned long G3167_l_ChipMemoryBlock1ByteCount;
extern unsigned long G3168_l_FastMemoryBlockByteCount;
#endif
#ifdef MEDIA755_A36M_A31M_A33M_A35E_A35M
extern long G3167_l_ChipMemoryBlock1ByteCount;
extern long G3168_l_FastMemoryBlockByteCount;
#endif
extern struct Task* G3165_ps_CurrentTask;
extern FILE_HANDLE G3160_ps_NIL2;
extern FILE_HANDLE G3159_ps_NIL1;
extern AMISTRUCT* G3161_ac_Buffer724Bytes;
extern unsigned char* G3250_puc_ChipMemoryBlock2Bottom;
extern long G3251_l_ChipMemoryBlock2ByteCount;

extern long G3177_l_GameDiskChangeCounter;
extern long G3178_l_SaveDiskChangeCounter;
extern BOOLEAN G3179_B_GameDiskChanged;
extern BOOLEAN G3180_B_SaveDiskChanged;
extern COPPERSTRUCT* G3192_;
extern BOOLEAN G3126_B_ViewportIsBeingBlittedToScreen;
#ifndef NOCOPYPROTECTION
extern BOOLEAN G3210_WaitForCopperInterrupt_CPSX;
#endif
extern BOOLEAN G3208_B_;
extern char G3209_[4];
extern BOOLEAN G3120_B_;
extern unsigned int16_t* G3124_;
extern BOOLEAN G3125_B_;
extern unsigned int16_t G3078_aui_Palette_PreTitle[16];
extern unsigned int16_t G3079_aui_Palette_PreTitle2[16];
extern unsigned int16_t G3080_aui_Palette_PreTitle3[16];
extern unsigned int16_t G3081_aui_Palette_PreTitle4[16];
extern struct Interrupt G3224_s_Interrupt_CPSX;
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
extern SOUND_DATA_AMIGA G1022_as_SoundData[M513_SOUND_COUNT];
#endif
extern int16_t G3047_ai_CreatureNames[27];
extern int16_t G3043_;
extern int16_t G3044_;
extern int16_t G3045_;
extern int16_t G3046_;

extern BPTR DOSBase;
extern struct GfxBase* GfxBase;
extern struct IntuitionBase* IntuitionBase;
extern APTR LayersBase;
extern struct Device* G3154_ps_Device_Console;
extern struct Library* ExecBase;


/* Amiga functions not in Atari ST */
extern void F0500__MAIN_ConfigurePorts();
extern void F0501_SOUND_Deinitialize();
extern int16_t F0502_SOUND_CompareVolumes();
extern void F0503_SOUND_LoadAll();
extern void F0504_SOUND_ReadSecondSector_CPSD();
extern BOOLEAN F0505_SOUND_GetVolume();
extern void F0506_AMIGA_AllocateData();
extern void F0507_AMIGA_DeinitializeAndInfiniteLoop();
extern void F0508_AMIGA_BuildPaletteChangeCopperList();
extern void F0509_AMIGA_FillScreen();
extern void F0510_AMIGA_WaitBottomOfViewPort();
extern void F0511_AMIGA_EmptyFunction();
extern BOOLEAN F0512_STARTUP1_IsAltKeyPressed();
/*extern void F0513_DIALOG_DrawGameReadyToPlay_Unreferenced();*/
extern int16_t F0514_MOVE_GetSound();
extern void F0515_CHAMPION_ConvertPortraitsToAtariSTPlanar();
extern void F0516_CHAMPION_ConvertPortraitsFromAtariSTPlanar();
extern void F0517_MENUS_AllocateSpellAreaBitmaps();
extern void F0518_FLOPPY_Deinitialize_CPSX();
extern int16_t F0519_FLOPPY_GetFormatResult();
extern long F0520_FLOPPY_GetSectorChecksum();
extern int16_t F0521_FLOPPY_GetIOError();
extern long F0522_FLOPPY_SendDosPacket();
extern BOOLEAN F0523_FLOPPY_InhibitFileSystem();
extern BOOLEAN F0524_FLOPPY_OpenTrackdiskDevice();
extern int16_t F0525_FLOPPY_GetWriteProtectionState();
#ifdef MEDIA423_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
extern int16_t F0526_FLOPPY_DoTrackdiskDeviceIO();
#endif
#ifdef MEDIA744_A36M
extern int16_t F0526_FLOPPY_DoTrackdiskDeviceIO(long P0957_ul_Command, ULONG P0958_ul_Length, UBYTE P0959_uc_Flags);
#endif
extern long F0527_FLOPPY_ReadFuzzySector_CPSX();
extern void F0528_FLOPPY_Eject();
extern BOOLEAN F0529_FLOPPY_IsFloppyInDrive();
extern BOOLEAN F0530_FLOPPY_DirectoryExists();
extern int16_t F0531_FLOPPY_CompareVolumeName();
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
extern BOOLEAN F0532_FLOPPY_GetVolumeInfoData();
#endif
#ifdef MEDIA410_A20ED
extern struct InfoData* F0532_FLOPPY_GetVolumeInfoData();
#endif
extern int16_t F0533_FLOPPY_WriteSavedGameInfoFiles();
extern long F0534_FLOPPY_GetFileSize();
extern long F0535_MEMORY_GetGraphicsDatFileSize();
extern BOOLEAN F0536_INPUT_Initialize();
extern void F0537_INPUT_ReleaseResources();
extern void F0538_INPUT_Deinitialize();
extern BOOLEAN F0539_INPUT_Cconis();
extern int16_t F0540_INPUT_Crawcin();
extern int16_t F0541_INPUT_WaitForMouseOrKeyboardActivity();
extern void S0542_INPUT_DeviceInterruptStub();
extern struct InputEvent* F0543_INPUT_DeviceInterruptHandler();
extern void F0544_INPUT_ResetPressingEyeOrMouth();
extern void F0545_MOUSE_AllocateMemory();
extern void F0546_MOUSE_Deinitialize();
extern void F0547_MOUSE_SetPointerSprites();
extern void F0548_MOUSE_HidePointer();
extern void F0549_MOUSE_ShowPointer();
extern void F0550_VIDEO_FillScreenBox();
extern void F0551_VIDEO_HatchBox_Unreferenced();
extern void F0552_BASE_DisplayError();
extern void F0553_TEXT_MESSAGEAREA_MoveCursorToTopLeft();
extern void F0554_TEXT_MESSAGEAREA_DeleteLastCharacter_Unreferenced();
extern BOOLEAN F0555_TEXT_AllocateMemory();
extern void F0556_TEXT_Deinitialize();
extern struct Message* F0557_SCROLLER_Initialize();
extern void F0558_SCROLLER_CancelInitialize();
extern void F0559_SCROLLER_Deinitialize();
extern void F0560_SCROLLER_SetCommand();
extern BOOLEAN F0561_SCROLLER_IsTextScrolling();
extern void F0562_SCROLLER_Task();
extern void F0563_SCROLLER_UpdateMessageArea();
extern void F0564_VIEWPORT_InitializeBitPlanes();
extern void F0565_VIEWPORT_SetPalette();
extern void F0566_VIEWPORT_BlitToScreen();
extern void F0567_COPYPROA_InitFloppyInterruptHandler_CPSX();
extern void F0568_COPYPROA_CleanupFloppyInterruptHandler_CPSX();
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
extern void F0569_COPYPROA_FloppyInterruptHandler_CPSX();
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
extern int16_t F0569_COPYPROA_FloppyInterruptHandler_CPSX();
#endif
extern void S0570_COPYPROA_IntHandlerStub_CPSX();
extern int16_t F0571_COPYPROB_InitializeDiskChangeHandler_CPSX();
extern void F0572_COPYPROB_ReleaseDiskChangeHandler_CPSX();
extern void F0573_COPYPROB_DiskChangeHandler_CPSX();
extern void S0574_COPYPROB_DiskChangeStub_CPSX();
extern void F0575_VerticalBlank_Initialize();
extern void F0576_VerticalBlank_Deinitialize();
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
extern void F0577_VerticalBlank_Handler_CPSDF();
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
extern int16_t F0577_VerticalBlank_Handler_CPSDF();
#endif
extern void S0578_VerticalBlank_HandlerStub();
extern void F0579_ENTRANCE_InitializeBitPlanes();
extern void F0580_ENTRANCE_DrawDoorAnimationStep();
extern void F0581_ENTRANCE_BlitDoors();



extern void F1050_AlertCSBSystemError();
extern void F1097_StoreKeyInBuffer();
extern void F1101_DetectDiskChange();
extern void F1110_DrawFormatProgressBar();
extern void F1053_Pre_F0380_COMMAND_ProcessQueue_CPSC();
extern void F1055_Post_F0380_COMMAND_ProcessQueue_CPSC();
extern void F1057_Pre_F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF();
extern void F1059_Post_F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF();
extern void F1036_Mouse1();
extern long F1108_GetDiskChangeCounter();
extern void F1067_InitAmigaStuff();
/*extern void F0536_INPUT_Initialize();*/
extern void F1051_(
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
void
#endif
);
#endif
#endif
