#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA042_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef MEDIA349_G14ED
char G4058_[5] = ".D00";
char G4059_[5] = ".D00";
char G4061_[] = "/DUNGEON.MASTER";
char G4062_[] = "/DUNGEON.SAVE";
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned int16_t G3989_i_GameDiskDrive;
unsigned int16_t G3998_i_SaveDiskDrive;
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
long G1084_l_GameDiskChangeVerticalBlankCount; /* Copy protection ? */
long G1085_l_SaveDiskChangeVerticalBlankCount; /* Copy protection ? */
unsigned long G1086_VerticalBlankCount; /* Copy protection ? */
struct InfoData* G1087_ps_VolumeInfoData;
int16_t G0574_i_SaveDiskFloppyDriveIndex;
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
unsigned char G1089_auc_DriveDeviceName[] = "DF0:";
unsigned char G1088_auc_DriveDeviceName[] = "DF?:";
unsigned char G1032_auc_DriveDeviceName[] = "df?:";
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
unsigned char G2048_auc_GameDiskDriveLetter[3] = "A:";
unsigned char G2049_auc_SavedGameDiskDriveLetter[3] = "A:";
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
struct FileInfoBlock* G3213_;
int16_t G0573_i_GameDiskFloppyDriveIndex = 0;
int16_t G0574_i_SaveDiskFloppyDriveIndex = 0;
long G3177_l_GameDiskChangeCounter = 0;
long G3178_l_SaveDiskChangeCounter = 0;
BOOLEAN G3179_B_GameDiskChanged = C1_TRUE;
BOOLEAN G3180_B_SaveDiskChanged = C1_TRUE;
BOOLEAN G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
#endif
#ifdef MEDIA363_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
BOOLEAN G0567_B_GameAndSaveDiskUseSameDrive;
#endif
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t G0568_ui_DiskType;
#endif
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
char* G0569_pc_SavedGameFileName;
char* G0570_pc_SavedGameBackupFileName;
#ifdef MEDIA410_A20ED
int16_t G0574_i_SaveDiskFloppyDriveIndex;
struct InfoData* G1087_ps_VolumeInfoData;
#endif
unsigned char* G0571_puc_GameDiskDriveName;
unsigned char* G0572_puc_SavedGameDiskDriveName;
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
BOOLEAN G1092_B_GameDiskDriveNotEmpty = C1_TRUE;
BOOLEAN G1093_B_SaveDiskDriveNotEmpty = C1_TRUE;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
unsigned char* G0571_puc_GameDiskDriveName = "DF0:";
unsigned char* G0572_puc_SavedGameDiskDriveName = "DF0:";
char* G1060_pc_GameDiskVolumeName = "DungeonMaster:";
char* G1061_pc_SaveDiskVolumeName = "DungeonSave:";
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
char G0575_ac_SavedGameFileName[] = "A:\\DMSAVE.DAT";
char G0576_ac_SavedGameBackupFileName[] = "A:\\DMSAVE.BAK";
#endif
#ifdef MEDIA671_F31E_F31J_P31J
char G0575_ac_SavedGameFileName[] = "A:\\CSBGAME.DAT";
char G0576_ac_SavedGameBackupFileName[] = "A:\\CSBGAME.BAK";
#endif
#ifdef MEDIA459_P20JA_P20JB_P31J
BOOLEAN G2228_B_RunningFromHardDisk;
#endif
#ifdef MEDIA493_F20E_F20J_P20JA_P20JB_F31E_F31J_P31J
char* G0569_pc_SavedGameFileName = G0575_ac_SavedGameFileName;
char* G0570_pc_SavedGameBackupFileName = G0576_ac_SavedGameBackupFileName;
#endif
#ifdef MEDIA618_A31E
char* G0569_pc_SavedGameFileName = "DF0:CSBGame.dat";
char* G0570_pc_SavedGameBackupFileName = "DF0:CSBGame.bak";
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t G3174_i_LastKeyIndex;
int16_t G3175_i_FirstKeyIndex;
long G2252_Unreferenced;
long G2253_Unreferenced;
#endif
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
unsigned char* G0571_puc_GameDiskDriveName = G2048_auc_GameDiskDriveLetter;
unsigned char* G0572_puc_SavedGameDiskDriveName = G2049_auc_SavedGameDiskDriveLetter;
#endif
#ifdef MEDIA577_X30J
char* G0569_pc_SavedGameFileName = "B:\\DMGame.dat";
char* G0570_pc_SavedGameBackupFileName = "B:\\DMGame.bak";
#endif
#ifdef MEDIA692_X31J
char* G0569_pc_SavedGameFileName = "B:\\CSBGame.dat";
char* G0570_pc_SavedGameBackupFileName = "B:\\CSBGame.bak";
#endif
#ifdef MEDIA707_I34E_I34M
BOOLEAN G2102_B_GameDiskIsHardDisk = C0_FALSE;
BOOLEAN G2103_B_SaveDiskIsHardDisk = C0_FALSE;
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
/* String "DM" in F0452_FLOPPY_GetDiskTypeInDrive_CPSB */
/* String "DM" in F0452_FLOPPY_GetDiskTypeInDrive_CPSB */
int16_t G2143_i_CurrentDefaultDriveOrdinal;
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
int16_t G2144_i_DriveOrdinal;
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
int16_t G2145_i_GameDiskDriveOrdinal;
int16_t G2146_i_SaveDiskDriveOrdinal;
#endif
#ifdef MEDIA607_X30J_X31J
int16_t G3091_i_ErrorCount;
char* G3095_pc_CopyProtectionIdentifier_CPSX = "HPR-0007"; /* Maybe static ? */
char G3096_ac_SaveGameFloppyLabel[] = "FTL DMSave"; /* Identical to G1061_pc_SaveDiskVolumeName ? */ /* Maybe static ? */
#endif
#ifdef MEDIA692_X31J
BOOLEAN G3140_;
BOOLEAN G3141_;
#endif
#ifdef MEDIA577_X30J
char G3099_ac_String[3];
#endif
#ifdef MEDIA692_X31J
char G3099_ac_String[2];
#endif
#ifdef MEDIA607_X30J_X31J
unsigned char G2048_auc_GameDiskDriveLetter[] = "A:\0";
unsigned char G2049_auc_SavedGameDiskDriveLetter[] = "B:\0";
#endif
#ifdef MEDIA388_G20E_G21E
char G4006_ac_[] = ":DUNGEON.SAVE";
char G4007_ac_[] = ":DUNGEON.SAVE:DMGAME.DAT";
char G4008_ac_[] = ":DUNGEON.SAVE:DMGAME.BAK";
#endif
#ifdef MEDIA349_G14ED
char G4007_ac_[] = "/DUNGEON.SAVE/DMGAME.DAT";
char G4008_ac_[] = "/DUNGEON.SAVE/DMGAME.BAK";
#endif
#ifdef MEDIA388_G20E_G21E
char G3988_ac_[] = "*:";
char G3990_ac_[] = "Unable to access game volume.   ";
char G3991_ac_[] = "Unable to access game device.   ";
char G3994_ac_[] = "Must boot from slot 5, unit 1 only!  ";
char G3995_ac_[] = "SmartPort firmware not detected in slot 5!  ";
char G3996_ac_[] = ".UNIDISK3.5";
char G3997_ac_[] = "Appledisk 3.5 operation only!  ";
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
char G4001_ac_[] = "DRIVE 1";
char G4002_ac_[] = "DRIVE 2";
#endif
#ifdef MEDIA388_G20E_G21E
char G4005_ac_[] = ":DUNGEON.MASTER";
GSString255 G4003_s_;
GSString255 G4004_s_;
#endif
#ifdef MEDIA349_G14ED
unsigned char G4056_auc_ParameterBlock[66];
char G4060_[18];
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
FILE_HANDLE G4081_i_FileHandle;
#endif


#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
overlay "start"
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
segment "gsthings"
#endif

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
#include "FILE.C"
#endif

#ifdef MEDIA271_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
void F0451_FLOPPY_Initialize(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA265_S20E_S21E /* CHANGE7_03_IMPROVEMENT Support for two floppy disk drives */
        REGISTER int16_t L1451_i_FloppyDriveCount;
        REGISTER long L1452_l_SupervisorStack;


        L1452_l_SupervisorStack = Super(0L);
        asm {
                move.w  C0x04A6_ADDRESS_SYSTEM_VARIABLE__nflops,L1451_i_FloppyDriveCount
        }
        Super(L1452_l_SupervisorStack);
        if (L1451_i_FloppyDriveCount == 2) {
                G0574_i_SaveDiskFloppyDriveIndex = C1_FLOPPY_DRIVE_B;
        } else {
                G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
        }
        G0571_puc_GameDiskDriveName = "DRIVE A:";
        G0572_puc_SavedGameDiskDriveName = "DRIVE B:";
#endif
#ifdef MEDIA349_G14ED
        DevNumRec L6447_;
        PathNameRec L6444_;
        VolumeRec L6448_;
        char L6449_[18];
        int16_t L6445_i_;


        L6444_.pathname = G4060_;
        F2224_CallProDOS_GET_BOOT_VOL(&L6444_);
        L6445_i_ = strlen(G4060_) - 1;
        if (G4060_[L6445_i_] == '/') {
                G4060_[L6445_i_] = '\0';
        }
        L6447_.devName = G4060_;
        L6447_.devNum = 0;
        F2223_CallProDOS_GET_DEV_NUM(&L6447_);
        G3989_i_GameDiskDrive = L6447_.devNum;
        G4058_[2] = (G3989_i_GameDiskDrive / 10) + '0';
        G4058_[3] = (G3989_i_GameDiskDrive % 10) + '0';
        G3998_i_SaveDiskDrive = G3989_i_GameDiskDrive + 1;
        G4059_[2] = (G3998_i_SaveDiskDrive / 10) + '0';
        G4059_[3] = (G3998_i_SaveDiskDrive % 10) + '0';
        L6448_.deviceName = G4059_;
        L6448_.volName = L6449_;
        F2217_CallProDOS_VOLUME(&L6448_);
        switch (_toolErr) {
                case devNotFound:
                case badDevRefNum:
                case noDevConnect:
                case notBlkDevErr:
                        G3998_i_SaveDiskDrive = G3989_i_GameDiskDrive;
                        G4059_[2] = (G3998_i_SaveDiskDrive / 10) + '0';
                        G4059_[3] = (G3998_i_SaveDiskDrive % 10) + '0';
                        G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
                        break;
                default:
                        G0567_B_GameAndSaveDiskUseSameDrive = C0_FALSE;
                        break;
        }
        G0571_puc_GameDiskDriveName = G4001_ac_;
        G0572_puc_SavedGameDiskDriveName = G4002_ac_;
#endif
#ifdef MEDIA388_G20E_G21E
        DevNumRecGS L6397_;
        GSString255 L6396_;
        ResultBuf32 L6400_;
        SysPrefsRecGS L6395_;
        DInfoRecGS L6399_;
        unsigned char* L6403_;


        L6395_.pCount = 1;
        L6395_.preferences = 0;
        SetSysPrefs(&L6395_);
        L6397_.pCount = 2;
        L6397_.devName = (GSString32Ptr)F2154_(G3988_ac_, &L6396_);
        L6397_.devNum = 0;
        GetDevNumber(&L6397_);
        if (_toolErr) {
                F2165_PrintErrorMessage(_toolErr, G3990_ac_);
        }
        G3989_i_GameDiskDrive = L6397_.devNum;
        L6399_.pCount = 10;
        L6399_.devNum = G3989_i_GameDiskDrive;
        L6400_.bufSize = sizeof(L6400_);
        L6399_.devName = &L6400_;
        DInfo(&L6399_);
        if (_toolErr) {
                F2165_PrintErrorMessage(_toolErr, G3991_ac_);
        }
        G4003_s_.length = L6400_.bufString.length;
        strcpy(G4003_s_.text, L6400_.bufString.text);
        if ((L6399_.slotNum != 5) || (L6399_.unitNum != 1)) {
                F2165_PrintErrorMessage(0, G3994_ac_);
        }
        L6403_ = (unsigned char*)0x0000c500;
        if ((L6403_[1] != 32) || (L6403_[3] != 0) || (L6403_[5] != 3) || (L6403_[7] != 0) || !(L6403_[251] & 0x80)) {
                F2165_PrintErrorMessage(0, G3995_ac_);
        }
        if ((L6399_.deviceID != 3) || (strncmp(L6400_.bufString.text, G3996_ac_, 11) == 0)) {
                F2165_PrintErrorMessage(0, G3997_ac_);
        }
        G3998_i_SaveDiskDrive = G3989_i_GameDiskDrive + 1;
        L6399_.pCount = 10;
        L6399_.devNum = G3998_i_SaveDiskDrive;
        L6400_.bufSize = sizeof(L6400_);
        L6399_.devName = &L6400_;
        DInfo(&L6399_);
        if (L6399_.deviceID == 3) {
                G0567_B_GameAndSaveDiskUseSameDrive = C0_FALSE;
                G4004_s_.length = L6400_.bufString.length;
                strcpy(G4004_s_.text, L6400_.bufString.text);
        } else {
                G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
                G3998_i_SaveDiskDrive = G3989_i_GameDiskDrive;
                G4004_s_.length = G4003_s_.length;
                strcpy(G4004_s_.text, G4003_s_.text);
        }
        G0571_puc_GameDiskDriveName = G4001_ac_;
        G0572_puc_SavedGameDiskDriveName = G4002_ac_;
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L1655_i_DriveIndex;


        if (!F0524_FLOPPY_OpenTrackdiskDevice(0)) {
                Alert(0x80444DE0, 0L);
                return;
        }
        CloseDevice(G0734_ps_AmigaData->IOExtTD);
        G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
        for (L1655_i_DriveIndex = 1; L1655_i_DriveIndex <= 3; L1655_i_DriveIndex++) {
                if (F0524_FLOPPY_OpenTrackdiskDevice(L1655_i_DriveIndex)) {
                        G0567_B_GameAndSaveDiskUseSameDrive = C0_FALSE;
                        CloseDevice(G0734_ps_AmigaData->IOExtTD);
                        break;
                }
        }
        if (G0567_B_GameAndSaveDiskUseSameDrive) {
                G0574_i_SaveDiskFloppyDriveIndex = 0;
                G0571_puc_GameDiskDriveName = G1089_auc_DriveDeviceName;
                G0572_puc_SavedGameDiskDriveName = NULL;
        } else {
                G0574_i_SaveDiskFloppyDriveIndex = L1655_i_DriveIndex;
                G1088_auc_DriveDeviceName[2] = L1655_i_DriveIndex + '0';
                G0571_puc_GameDiskDriveName = G1089_auc_DriveDeviceName;
                G0572_puc_SavedGameDiskDriveName = G1088_auc_DriveDeviceName;
        }
        G0569_pc_SavedGameFileName = G1062_pc_SavedGameFileName;
        G0570_pc_SavedGameBackupFileName = G1063_pc_SavedGameBackupFileName;
        G1087_ps_VolumeInfoData = AllocMem((long)sizeof(struct InfoData), MEMF_PUBLIC);
        if (G1087_ps_VolumeInfoData == NULL) {
                Alert(0x80444DE1, 0L);
        }
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        register int16_t L1655_i_DriveIndex = 1;
        register int16_t L2573_i_ = 1;
        register char L2574_c_DriveNumber = '0';


        G3213_ = (struct FileInfoBlock*)((long)((char*)&G3161_ac_Buffer724Bytes->FileInfoBlockBuffer + 3) & 0xFFFFFFFC);
        while (L1655_i_DriveIndex < 4) {
                if (F1106_IsTrackdiskDeviceOpened(L1655_i_DriveIndex)) {
                        L2573_i_++;
                        break;
                }
                L1655_i_DriveIndex++;
        }
        L2574_c_DriveNumber += L1655_i_DriveIndex;
        if (L2573_i_ > 1) {
                G0574_i_SaveDiskFloppyDriveIndex = L1655_i_DriveIndex;
                G0567_B_GameAndSaveDiskUseSameDrive = C0_FALSE;
                G0572_puc_SavedGameDiskDriveName[2] = L2574_c_DriveNumber;
                G0569_pc_SavedGameFileName[2] = L2574_c_DriveNumber;
                G0570_pc_SavedGameBackupFileName[2] = L2574_c_DriveNumber;
        }
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        asm     mov     dx, offset interrupt
        asm     push    ds
        asm     push    cs
        asm     pop     ds
        asm     mov     ax, 0x2524
        asm     int     0x21     /* DOS - SET INTERRUPT VECTOR */
                                /* AL = interrupt number, DS:DX = new vector to be used for specified interrupt */
        asm     pop     ds
        asm     jmp loc_141A7
        asm     interrupt:
        asm     mov     al, 3
        asm     iret
        loc_141A7:
        asm     mov     ah, 0x19
        asm     int     0x21     /* DOS - GET DEFAULT DISK NUMBER */
        asm     mov     ah, 0
        asm     inc     ax
        asm     mov     G2143_i_CurrentDefaultDriveOrdinal, ax
        if (F0715_GetConvertedDeviceType(G2143_i_CurrentDefaultDriveOrdinal) == C1_FIXED_DISK_DEVICE) { /* Hard disk */
#ifdef MEDIA459_P20JA_P20JB_P31J
                G2228_B_RunningFromHardDisk = C1_TRUE;
#endif
                G2145_i_GameDiskDriveOrdinal = G2143_i_CurrentDefaultDriveOrdinal;
#ifdef MEDIA707_I34E_I34M
                G2102_B_GameDiskIsHardDisk = C1_TRUE;
#endif
#ifdef MEDIA459_P20JA_P20JB_P31J
                G2146_i_SaveDiskDriveOrdinal = M000_INDEX_TO_ORDINAL(C0_FLOPPY_DRIVE_A);
#endif
#ifdef MEDIA707_I34E_I34M
                G2146_i_SaveDiskDriveOrdinal = G2143_i_CurrentDefaultDriveOrdinal;
                G2103_B_SaveDiskIsHardDisk = C1_TRUE;
#endif
                G2144_i_DriveOrdinal = M000_INDEX_TO_ORDINAL(C0_FLOPPY_DRIVE_A);
#ifdef MEDIA459_P20JA_P20JB_P31J
                G0567_B_GameAndSaveDiskUseSameDrive = C0_FALSE;
#endif
#ifdef MEDIA707_I34E_I34M
                G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
#endif
        } else {
#ifdef MEDIA459_P20JA_P20JB_P31J
                G2228_B_RunningFromHardDisk = C0_FALSE;
#endif
                G2145_i_GameDiskDriveOrdinal = G2143_i_CurrentDefaultDriveOrdinal;
                G2144_i_DriveOrdinal = G2143_i_CurrentDefaultDriveOrdinal;
                if (G2143_i_CurrentDefaultDriveOrdinal == M000_INDEX_TO_ORDINAL(C0_FLOPPY_DRIVE_A)) {
                        if (F0715_GetConvertedDeviceType(M000_INDEX_TO_ORDINAL(C1_FLOPPY_DRIVE_B)) && (F0715_GetConvertedDeviceType(M000_INDEX_TO_ORDINAL(C0_FLOPPY_DRIVE_A)) == F0715_GetConvertedDeviceType(M000_INDEX_TO_ORDINAL(C1_FLOPPY_DRIVE_B)))) {
                                G2146_i_SaveDiskDriveOrdinal = M000_INDEX_TO_ORDINAL(C1_FLOPPY_DRIVE_B);
                                G0567_B_GameAndSaveDiskUseSameDrive = C0_FALSE;
                        } else {
                                G2146_i_SaveDiskDriveOrdinal = G2143_i_CurrentDefaultDriveOrdinal;
                                G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
                        }
                } else {
                        if (G2143_i_CurrentDefaultDriveOrdinal == M000_INDEX_TO_ORDINAL(C1_FLOPPY_DRIVE_B)) {
                                if (F0715_GetConvertedDeviceType(M000_INDEX_TO_ORDINAL(C0_FLOPPY_DRIVE_A)) && (F0715_GetConvertedDeviceType(M000_INDEX_TO_ORDINAL(C0_FLOPPY_DRIVE_A)) == F0715_GetConvertedDeviceType(M000_INDEX_TO_ORDINAL(C1_FLOPPY_DRIVE_B)))) {
                                        G2146_i_SaveDiskDriveOrdinal = M000_INDEX_TO_ORDINAL(C0_FLOPPY_DRIVE_A);
                                        G0567_B_GameAndSaveDiskUseSameDrive = C0_FALSE;
                                } else {
                                        G2146_i_SaveDiskDriveOrdinal = G2143_i_CurrentDefaultDriveOrdinal;
                                        G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
                                }
                        } else {
                                G2146_i_SaveDiskDriveOrdinal = G2143_i_CurrentDefaultDriveOrdinal;
                                G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
                        }
                }
        }
        G2048_auc_GameDiskDriveLetter[0] = 'A' + G2145_i_GameDiskDriveOrdinal - (unsigned int16_t)1;
#ifdef MEDIA459_P20JA_P20JB_P31J
        G0575_ac_SavedGameFileName[0] = G0576_ac_SavedGameBackupFileName[0] = G2049_auc_SavedGameDiskDriveLetter[0] = 'A' + G2146_i_SaveDiskDriveOrdinal - (unsigned int16_t)1;
#endif
#ifdef MEDIA707_I34E_I34M
        G1149_pc_BonusDungeonFileName[0] = G1064_pc_ExpansionSetDungeonFileName[0] = G0569_pc_SavedGameFileName[0] = G0570_pc_SavedGameBackupFileName[0] = G2049_auc_SavedGameDiskDriveLetter[0] = 'A' + G2146_i_SaveDiskDriveOrdinal - (unsigned int16_t)1;
#endif
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        F2251_INSTALL_CRITICAL_HANDLER();
        G2146_i_SaveDiskDriveOrdinal = 1;
        G2145_i_GameDiskDriveOrdinal = 4;
        G0567_B_GameAndSaveDiskUseSameDrive = C1_TRUE;
        G0575_ac_SavedGameFileName[0] = G0576_ac_SavedGameBackupFileName[0] = G2049_auc_SavedGameDiskDriveLetter[0] = G2048_auc_GameDiskDriveLetter[0] = 'A' + G2146_i_SaveDiskDriveOrdinal - 1;
#endif
}
#endif

#ifdef MEDIA607_X30J_X31J
#include "FILE.C"

int16_t F1026_IdentifyDiskInDrive_CPSX(
int16_t P3087_i_DrivePDA FINAL_SEPARATOR
{
        char L2575_ac_SectorBuffer[1024];
#ifndef NOCOPYPROTECTION
        register char L2576_c_ReadResult;
#endif


        asm {
#ifndef NOCOPYPROTECTION
                        bsr.s   @TReadSec9
                        move.b  d0,d7           /* L2576_c_ReadResult */
                        bsr.s   @TReadSec9
                        cmp.b   d7,d0           /* If both readings give the same result then the disk is not an original game disk. An original disk gives random results for each reading */
                        beq.s   @Tloc_1FD2C
#else /* Crack */
                        cmpi.b  #0x91,P3087_i_DrivePDA+1(a6)    /* If specified drive is the save disk drive */
                        beq.w   @Tloc_1FD8E
#endif
                        moveq   #1,d0           /* Game disk */
                        bra.w   @Tloc_1FDC6
                @Tloc_1FD2C:
                        jsr     F1031_IsOperationSuccessful
                        beq.w   @Tloc_1FDC4     /* If operation failed */
                        moveq   #2,d0           /* Save disk */
                        bra.w   @Tloc_1FDC6

#ifndef NOCOPYPROTECTION
                @TReadSec9:    /* Check if original game disk: read track 1, side 1, sector 9 as a 256 bytes sector and check its first 8 characters */
                        moveq   #0x46,d0        /* B_READ */
                        move.w  P3087_i_DrivePDA(a6),d1
                        lsl.w   #8,d1
                        addi.w  #0x50,d1        /* 0x50: Mode (01010000 Bit 6 = 1: MFM, Bit 5 = 0: Do not retry, Bit 4 = 1: Seek and then execute) */
                        move.l  #0x01010109,d2  /* 4 bytes: Sector length 1 (0: 128, 1: 256, 2: 512, 3: 1024), Track 1 (0..79), Side 1 (0..1), Sector 9 (1..n) */
                        move.l  #256,d3         /* Number of bytes to read */
                        lea     L2575_ac_SectorBuffer(a6),a1
                        trap    #0xF            /* TRAP 15 (IOCS CALL) */
                        btst    #0x1E,d0        /* FDC Status Byte 0 (STA0) bit 6 = 1: Abnormal command termination or drive status changed */
                        beq.s   @Tloc_1FD8E
                        btst    #0x15,d0        /* FDC Status Byte 1 (STA1) bit 5 = 1: Sector ID or CRC error on disk */
                        beq.s   @Tloc_1FD8E
                        btst    #0xD,d0         /* FDC Status Byte 2 (STA2) bit 5 = 1: Sector data CRC error */
                        beq.s   @Tloc_1FD8E
                /* Compare first 8 characters of sector with "HPR-0007" */
                        moveq   #8,d0
                        lea     L2575_ac_SectorBuffer(a6),a0
                        movea.l G3095_pc_CopyProtectionIdentifier_CPSX(a5),a1
                @Tloc_1FD74:
                        cmpm.b  (a0)+,(a1)+
                        bne.s   @Tloc_1FD2C     /* If a difference is found then the disk not the game disk */
                        subq.b  #1,d0
                        bne.s   @Tloc_1FD74
                /* If the disk is the game disk */
                        move.b  L2575_ac_SectorBuffer+8(a6),d0  /* Return value is the sum of the 4 bytes following the "HPR-0007" string, these bytes have random values (fuzzy/weak bits) */
                        add.b   L2575_ac_SectorBuffer+9(a6),d0
                        add.b   L2575_ac_SectorBuffer+10(a6),d0
                        add.b   L2575_ac_SectorBuffer+11(a6),d0
                        rts
#endif

                @Tloc_1FD8E: /* Try to read track 1, side 1, sector 6 as a 1024 bytes sector (an arbitrary sector choice). If successful then the disk is a formatted save disk else it is an unformatted disk */
                        clr.w   G3091_i_ErrorCount(a5)
                        moveq   #0x46,d0        /* B_READ */
                        move.w  P3087_i_DrivePDA(a6),d1
                        lsl.w   #8,d1
                        addi.w  #0x50,d1        /* 0x50: Mode (01010000 Bit 6 = 1: MFM, Bit 5 = 0: Do not retry, Bit 4 = 1: Seek and then execute) */
                        move.l  #0x03010106,d2  /* 4 bytes: Sector length 3 (0: 128, 1: 256, 2: 512, 3: 1024), Track 1 (0..79), Side 1 (0..1), Sector 6 (1..n) */
                        move.l  #1024,d3        /* Number of bytes to read */
                        lea     L2575_ac_SectorBuffer(a6),a1
                        trap    #0xF            /* TRAP 15 (IOCS CALL) */
                        btst    #0x1E,d0        /* FDC Status Byte 0 (STA0) bit 6 = 1: Abnormal command termination or drive status changed */
                        bne.s   @Tloc_1FDC4
                        btst    #0x15,d0        /* FDC Status Byte 1 (STA1) bit 5 = 1: Sector ID or CRC error on disk */
                        bne.s   @Tloc_1FDC4
                        btst    #0xD,d0         /* FDC Status Byte 2 (STA2) bit 5 = 1: Sector data CRC error */
                        beq.w   @Tloc_1FD2C
                @Tloc_1FDC4:
                        moveq   #0,d0           /* Unformatted disk */
                @Tloc_1FDC6:
        }
}
#endif

unsigned int16_t F0452_FLOPPY_GetDiskTypeInDrive_CPSB(
#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB
)
#endif
#ifdef MEDIA267_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0861_ui_DriveType)
#endif
#ifdef MEDIA278_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0861_ui_DriveType FINAL_SEPARATOR
#endif
{
#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_03_IMPROVEMENT */
        REGISTER unsigned int16_t L1453_ui_DiskType;
        REGISTER int16_t L1455_i_GraphicsDatFileReferenceCountBackup;
        REGISTER unsigned char* L1456_puc_Buffer_CPSB;


        if (L1455_i_GraphicsDatFileReferenceCountBackup = G0631_i_GraphicsDatFileReferenceCount) {
                G0631_i_GraphicsDatFileReferenceCount = 1;
                F0478_MEMORY_CloseGraphicsDat_CPSDF();
        }
        L1456_puc_Buffer_CPSB = F0468_MEMORY_Allocate(1024L, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        F0450_FLOPPY_ForceMediaChangeDetection();
        if (Floprd(L1456_puc_Buffer_CPSB, C0L_FILLER, C0_FLOPPY_DRIVE_A, C001_SECTOR_1, C0_TRACK_0, C0_SIDE_0, C2_TWO_SECTORS)) {
                L1453_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
        } else {
                if (!Floprd(L1456_puc_Buffer_CPSB, C0L_FILLER, C0_FLOPPY_DRIVE_A, C010_SECTOR_10, C0_TRACK_0, C0_SIDE_0, C1_ONE_SECTOR)
#ifndef NOCOPYPROTECTION
                && !Floprd(L1456_puc_Buffer_CPSB, C0L_FILLER, C0_FLOPPY_DRIVE_A, C247_SECTOR_247, C0_TRACK_0, C0_SIDE_0, C1_ONE_SECTOR) && !M546_STRCMP(L1456_puc_Buffer_CPSB, "Copyright (c) 1987, Software Heaven, Inc.") && !M546_STRCMP(&L1456_puc_Buffer_CPSB[128], "DungeonMaster")
#endif
                ) {
                        L1453_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                } else {
#ifdef MEDIA002_S10EA_S10EB_S11E /* CHANGE3_20_OPTIMIZATION */
                        if (F0449_FLOPPY_IsDiskWriteProtected(C0_FLOPPY_DRIVE_A, L1456_puc_Buffer_CPSB)) {
#endif
#ifdef MEDIA236_S12E_S12G_S13FA_S13FB /* CHANGE3_20_OPTIMIZATION */
                        if (F0449_FLOPPY_IsDiskWriteProtected(L1456_puc_Buffer_CPSB)) {
#endif
                                L1453_ui_DiskType = C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED;
                        } else {
                                L1453_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                        }
                }
        }
        F0469_MEMORY_FreeAtHeapTop(1024L);
        if (L1455_i_GraphicsDatFileReferenceCountBackup) {
                F0477_MEMORY_OpenGraphicsDat_CPSDF();
                G0631_i_GraphicsDatFileReferenceCount = L1455_i_GraphicsDatFileReferenceCountBackup;
        }
        return L1453_ui_DiskType;
}
#endif
#ifdef MEDIA278_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef MEDIA265_S20E_S21E /* CHANGE7_03_IMPROVEMENT Support for two floppy disk drives. Disk type is returned in G0568_ui_DiskType */
        REGISTER unsigned int16_t L1453_ui_DiskType;
        REGISTER int16_t L1454_i_FloppyDriveIndex;
        REGISTER int16_t L1455_i_GraphicsDatFileReferenceCountBackup;
        REGISTER unsigned char* L1456_puc_Buffer_CPSB;


        if (P0861_ui_DriveType == C0_DRIVE_TYPE_NONE) {
                return C4_DISK_TYPE_NO_DISK;
        }
        if (L1455_i_GraphicsDatFileReferenceCountBackup = G0631_i_GraphicsDatFileReferenceCount) {
                G0631_i_GraphicsDatFileReferenceCount = 1;
                F0478_MEMORY_CloseGraphicsDat_CPSDF();
        }
        L1456_puc_Buffer_CPSB = F0468_MEMORY_Allocate(1024L, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        if (P0861_ui_DriveType == C1_DRIVE_TYPE_GAME_DISK) {
                L1454_i_FloppyDriveIndex = G0573_i_GameDiskFloppyDriveIndex;
        } else {
                L1454_i_FloppyDriveIndex = G0574_i_SaveDiskFloppyDriveIndex;
        }
        F0450_FLOPPY_ForceMediaChangeDetection(P0861_ui_DriveType);
        if (Floprd(L1456_puc_Buffer_CPSB, C0L_FILLER, L1454_i_FloppyDriveIndex, C001_SECTOR_1, C0_TRACK_0, C0_SIDE_0, C2_TWO_SECTORS)) {
                L1453_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
        } else {
                if (!Floprd(L1456_puc_Buffer_CPSB, C0L_FILLER, L1454_i_FloppyDriveIndex, C010_SECTOR_10, C0_TRACK_0, C0_SIDE_0, C1_ONE_SECTOR)
#ifndef NOCOPYPROTECTION
                && !Floprd(L1456_puc_Buffer_CPSB, C0L_FILLER, L1454_i_FloppyDriveIndex, C247_SECTOR_247, C0_TRACK_0, C0_SIDE_0, C1_ONE_SECTOR) && !M546_STRCMP(L1456_puc_Buffer_CPSB, "Copyright (c) 1987, Software Heaven, Inc.") && !M546_STRCMP(&L1456_puc_Buffer_CPSB[128], "DungeonMaster")
#endif
                ) {
                        L1453_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                } else {
                        if (F0449_FLOPPY_IsDiskWriteProtected(L1454_i_FloppyDriveIndex, L1456_puc_Buffer_CPSB)) {
                                L1453_ui_DiskType = C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED;
                        } else {
                                L1453_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                        }
                }
        }
        F0469_MEMORY_FreeAtHeapTop(1024L);
        if (L1455_i_GraphicsDatFileReferenceCountBackup) {
                F0477_MEMORY_OpenGraphicsDat_CPSDF();
                G0631_i_GraphicsDatFileReferenceCount = L1455_i_GraphicsDatFileReferenceCountBackup;
        }
        return (G0568_ui_DiskType = L1453_ui_DiskType);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
#ifdef MEDIA349_G14ED
        VolumeRec L6450_;
        char L6451_[18];
#endif
#ifdef MEDIA388_G20E_G21E
        VolumeRecGS L6404_;
        ResultBuf32 L6405_;
#endif
        int16_t L1453_ui_DiskType;
        int16_t L1455_i_GraphicsDatFileReferenceCountBackup;
        int16_t L6407_i_Unreferenced;


        if (L1455_i_GraphicsDatFileReferenceCountBackup = G0631_i_GraphicsDatFileReferenceCount) {
                G0631_i_GraphicsDatFileReferenceCount = 1;
                F0478_MEMORY_CloseGraphicsDat_CPSDF();
        }
#ifdef MEDIA349_G14ED
        if (P0861_ui_DriveType == C1_DRIVE_TYPE_GAME_DISK) {
                L6450_.deviceName = G4058_;
        } else {
                L6450_.deviceName = G4059_;
        }
        L6450_.volName = L6451_;
        F2217_CallProDOS_VOLUME(&L6450_);
#endif
#ifdef MEDIA388_G20E_G21E
        L6404_.pCount = 2;
        if (P0861_ui_DriveType == C1_DRIVE_TYPE_GAME_DISK) {
                L6404_.devName = &G4003_s_;
        } else {
                L6404_.devName = &G4004_s_;
        }
        L6405_.bufSize = sizeof(L6405_);
        L6404_.volName = &L6405_;
        Volume(&L6404_);
#endif
        if (_toolErr) {
                switch (_toolErr) {
                        case ioError:
                        case versionErr:
                        case badVolType:
                                L1453_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
                                break;
                        case 0x2f:
                                L1453_ui_DiskType = C4_DISK_TYPE_NO_DISK;
                                break;
                        default:
                                L1453_ui_DiskType = C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED;
                                break;
                }
        } else {
#ifdef MEDIA349_G14ED
                if ((strcmp(G4061_, L6451_) == 0) && (strcmp(G4060_, L6451_) == 0)) {
                        L1453_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                } else {
                        if (strcmp(G4062_, L6451_) == 0) {
                                L1453_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                        } else {
                                L1453_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
                        }
                }
#endif
#ifdef MEDIA388_G20E_G21E
                if (strcmp(G4005_ac_, L6405_.bufString.text) == 0) {
                        L1453_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                } else {
                        if (strcmp(G4006_ac_, L6405_.bufString.text) == 0) {
                                L1453_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                        } else {
                                L1453_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
                        }
                }
#endif
        }
        if (L1455_i_GraphicsDatFileReferenceCountBackup) {
                F0477_MEMORY_OpenGraphicsDat_CPSDF();
                G0631_i_GraphicsDatFileReferenceCount = L1455_i_GraphicsDatFileReferenceCountBackup;
        }
#ifdef MEDIA388_G20E_G21E
        if ((F0464_CPSC_GetChecksumSub(F0380_COMMAND_ProcessQueue_CPSC, F2203_CPSX) != CHECKSUM_M) ||
             !F2152_CPSX(F0380_COMMAND_ProcessQueue_CPSC, F2204_CPSX) ||
             !F2151_CPSX(F0380_COMMAND_ProcessQueue_CPSC, F2205_CPSX)) {
                return G0568_ui_DiskType = C4_DISK_TYPE_NO_DISK;
        }
#endif
        return G0568_ui_DiskType = L1453_ui_DiskType;
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L1454_i_FloppyDriveIndex;
        REGISTER int16_t L1656_i_;
        REGISTER struct InfoData* L1657_ps_InfoData;
        REGISTER struct DeviceList* L1658_ps_DeviceList;
#ifdef MEDIA410_A20ED
        REGISTER char* L1659_pc_VolumeName;
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L1660_i_;
        REGISTER int16_t L1661_i_Unreferenced;
#endif


        L1656_i_ = 0;
        if (P0861_ui_DriveType == C1_DRIVE_TYPE_GAME_DISK) {
                L1454_i_FloppyDriveIndex = 0;
        } else {
                L1454_i_FloppyDriveIndex = G0574_i_SaveDiskFloppyDriveIndex;
        }
#ifdef MEDIA410_A20ED
        for (;;) { /*_Infinite loop_*/
                L1657_ps_InfoData = F0532_FLOPPY_GetVolumeInfoData(L1454_i_FloppyDriveIndex);
                if ((!L1657_ps_InfoData) || (L1657_ps_InfoData->id_DiskType == -1)) {
                        if (L1656_i_ < 1) {
                                Delay(100L);
                                L1656_i_++;
                                continue;
                        }
                        if (!L1657_ps_InfoData) {
                                G0568_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
                        } else {
                                G0568_ui_DiskType = C4_DISK_TYPE_NO_DISK;
                        }
                        goto T0452000;
                }
                if (L1657_ps_InfoData->id_DiskState == ID_VALIDATING) {
                        Delay(100L);
                } else {
                        break;
                }
        };
        if (L1657_ps_InfoData->id_DiskType == ID_WRITE_PROTECTED) {
                G0568_ui_DiskType = C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED;
        } else {
                L1658_ps_DeviceList = (struct DeviceList*)BADDR(L1657_ps_InfoData->id_VolumeNode);
                L1659_pc_VolumeName = (char*)BADDR(L1658_ps_DeviceList->dl_Name);
                if (F0531_FLOPPY_CompareVolumeName(G1060_pc_GameDiskVolumeName, L1659_pc_VolumeName)) {
                        G0568_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                } else {
                        if (F0531_FLOPPY_CompareVolumeName(G1061_pc_SaveDiskVolumeName, L1659_pc_VolumeName)) {
                                G0568_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                        } else {
                                G0568_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
                        }
                }
        }
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        for (;;) { /*_Infinite loop_*/
                L1660_i_ = F0525_FLOPPY_GetWriteProtectionState(L1454_i_FloppyDriveIndex);
                if (!L1660_i_) { /* No disk in drive */
                        if (L1656_i_ < 1) {
                                Delay(100L);
                                L1656_i_++;
                                continue;
                        }
                        G0568_ui_DiskType = C4_DISK_TYPE_NO_DISK;
                        goto T0452000;
                }
                break;
        };
        if (F0532_FLOPPY_GetVolumeInfoData(G1060_pc_GameDiskVolumeName, L1454_i_FloppyDriveIndex)) {
                G0568_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
        } else {
                if (F0532_FLOPPY_GetVolumeInfoData(G1061_pc_SaveDiskVolumeName, L1454_i_FloppyDriveIndex)) {
                        G0568_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                } else {
                        G0568_ui_DiskType = (L1660_i_ == 1) ? C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED : C3_DISK_TYPE_UNFORMATTED_DISK;
                }
        }
#endif
        T0452000:
        return G0568_ui_DiskType;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        register int16_t L1454_i_FloppyDriveIndex;
        register int16_t L1660_i_;
        register int16_t L2577_i_;
        register unsigned int16_t L1453_ui_DiskType;
        register unsigned int16_t L2578_ui_;
        register char* L2579_pc_;
        register struct FileLock* L2580_ps_FileLock;
        register struct FileInfoBlock* L2581_ps_FileInfoBlock;


        L1454_i_FloppyDriveIndex = G0573_i_GameDiskFloppyDriveIndex;
        L2577_i_ = 0;
        L1453_ui_DiskType = C4_DISK_TYPE_NO_DISK;
        L2579_pc_ = G0571_puc_GameDiskDriveName;
        if (P0861_ui_DriveType) {
                if (P0861_ui_DriveType == C2_DRIVE_TYPE_SAVE_DISK) {
                        L1454_i_FloppyDriveIndex = G0574_i_SaveDiskFloppyDriveIndex;
                        L2579_pc_ = G0572_puc_SavedGameDiskDriveName;
                }
                do {
                        if (L2577_i_) {
                                Delay(12L);
                        }
                        L1660_i_ = F1109_GetDiskState(L1454_i_FloppyDriveIndex);
                } while ((L1660_i_ == 0) && (L2577_i_++ < 12));
                L1453_ui_DiskType = C4_DISK_TYPE_NO_DISK;
                if (L1660_i_) {
                        L1453_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
                        L2577_i_ = 0;
                        do {
                                if (L2577_i_) {
                                        Delay(6L);
                                }
                                L2580_ps_FileLock = Lock(L2579_pc_); /* BUGX_XX: second parameter missing in call */
                        } while (!L2580_ps_FileLock && (L2577_i_++ < 20));
                        if (L2580_ps_FileLock) {
                                L2581_ps_FileInfoBlock = G3213_;
                                if (Examine(L2580_ps_FileLock, L2581_ps_FileInfoBlock)) {
                                        L2578_ui_ = F0090_strlen(L2581_ps_FileInfoBlock->fib_FileName);
                                        L2581_ps_FileInfoBlock->fib_FileName[L2578_ui_] = ':';
                                        L2581_ps_FileInfoBlock->fib_FileName[L2578_ui_ + 1] = '\0';
                                        if (F0087_strcmp(G1060_pc_GameDiskVolumeName, L2581_ps_FileInfoBlock->fib_FileName) == 0) {
                                                L1453_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                                        }
                                        if (F0087_strcmp(G1061_pc_SaveDiskVolumeName, L2581_ps_FileInfoBlock->fib_FileName) == 0) {
                                                L1453_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                                        }
                                }
                                UnLock(L2580_ps_FileLock);
                                if ((L1660_i_ == 1) && (P0861_ui_DriveType == C2_DRIVE_TYPE_SAVE_DISK) && (L1453_ui_DiskType == C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED)) {
                                        L1453_ui_DiskType = C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED;
                                }
                        }
                }
        }
        G0568_ui_DiskType = L1453_ui_DiskType;
        return G0568_ui_DiskType;
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        char L2582_s_VolumeName[16];


#ifdef MEDIA459_P20JA_P20JB_P31J
        if ((P0861_ui_DriveType == C1_DRIVE_TYPE_GAME_DISK) && G2228_B_RunningFromHardDisk) {
                G0568_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
        } else {
#endif
                if (P0861_ui_DriveType == C1_DRIVE_TYPE_GAME_DISK) {
#ifdef MEDIA707_I34E_I34M
                        if (G2102_B_GameDiskIsHardDisk) {
                                G0568_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                        } else {
#endif
                                switch (F0714_GetReadFirstSectorResult(G2145_i_GameDiskDriveOrdinal)) { /* Can only return 0 or 1 on PC */
                                        case 1:
                                                F0717_GetVolumeName(G2145_i_GameDiskDriveOrdinal, L2582_s_VolumeName);
                                                if (!strcmp(L2582_s_VolumeName, "DM")) {
                                                        G0568_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                                                } else {
                                                        G0568_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                                                }
                                                break;
                                        case 2:
                                                F0717_GetVolumeName(G2145_i_GameDiskDriveOrdinal, L2582_s_VolumeName);
                                                if (!strcmp(L2582_s_VolumeName, "DM")) {
                                                        G0568_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                                                } else {
                                                        G0568_ui_DiskType = C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED;
                                                }
                                                break;
                                        case 0:
                                                G0568_ui_DiskType = C4_DISK_TYPE_NO_DISK;
                                                break;
                                        default:
                                                G0568_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
                                }
#ifdef MEDIA707_I34E_I34M
                        }
#endif
                } else {
                        if (P0861_ui_DriveType == C2_DRIVE_TYPE_SAVE_DISK) {
#ifdef MEDIA707_I34E_I34M
                                if (G2103_B_SaveDiskIsHardDisk) {
                                        G0568_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                                } else {
#endif
                                        switch (F0714_GetReadFirstSectorResult(G2146_i_SaveDiskDriveOrdinal)) { /* Can only return 0 or 1 on PC */
                                                case 1:
                                                        G0568_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
#ifdef MEDIA707_I34E_I34M
                                                        break;
                                                case 0:
                                                        G0568_ui_DiskType = C4_DISK_TYPE_NO_DISK;
#endif
                                                        break;
                                                case 2:
                                                        G0568_ui_DiskType = C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED;
                                                        break;
                                                default:
                                                        G0568_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
#ifdef MEDIA459_P20JA_P20JB_P31J
                                                        break;
                                                case 0:
                                                        G0568_ui_DiskType = C4_DISK_TYPE_NO_DISK;
#endif
                                        }
#ifdef MEDIA707_I34E_I34M
                                }
#endif
                        } else {
                                G0568_ui_DiskType = C4_DISK_TYPE_NO_DISK;
                        }
                }
#ifdef MEDIA459_P20JA_P20JB_P31J
        }
#endif
        return G0568_ui_DiskType;
#endif
#ifdef MEDIA607_X30J_X31J
        int16_t L2583_i_DrivePDA;
        int16_t L2584_i_DriveStatus;


        if (P0861_ui_DriveType == C0_DRIVE_TYPE_NONE) {
                return G0568_ui_DiskType = C4_DISK_TYPE_NO_DISK;
        }
        if (P0861_ui_DriveType == C1_DRIVE_TYPE_GAME_DISK) {
                L2583_i_DrivePDA = 0x90; /* Drive 0 */
        } else {
                L2583_i_DrivePDA = 0x91; /* Drive 1 */
        }
        if ((L2584_i_DriveStatus = F1025_GetFloppyDriveStatus(L2583_i_DrivePDA)) == 2) { /* If floppy drive is not ready */
                return G0568_ui_DiskType = C4_DISK_TYPE_NO_DISK;
        }
        switch (F1026_IdentifyDiskInDrive_CPSX(L2583_i_DrivePDA)) {
                case 0:
                        if (L2584_i_DriveStatus == 1) { /* If floppy drive is write protected */
                                return G0568_ui_DiskType = C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED;
                        } else {
                                return G0568_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
                        }
                case 1:
                        return G0568_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
                case 2:
                        if (L2584_i_DriveStatus == 1) { /* If floppy drive is write protected */
                                return G0568_ui_DiskType = C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED;
                        } else {
                                return G0568_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
                        }
        }
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        if (P0861_ui_DriveType == C1_DRIVE_TYPE_GAME_DISK) {
                G0568_ui_DiskType = C0_DISK_TYPE_GAME_DISK;
        } else {
                G0568_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
        }
        return G0568_ui_DiskType;
#endif
}
#endif

#ifdef MEDIA283_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
BOOLEAN F0453_FLOPPY_IsFormatDiskSuccessful(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA265_S20E_S21E /* CHANGE7_31_IMPROVEMENT */
        REGISTER unsigned int16_t L1457_ui_TrackIndex;
        REGISTER BOOLEAN L1458_B_IsFormatDiskSuccessful;
        REGISTER long L1459_l_ByteCount;
        REGISTER unsigned char* L1460_puc_Buffer;


        L1458_B_IsFormatDiskSuccessful = C1_TRUE;
        L1459_l_ByteCount = G0648_l_AvailableHeapMemoryByteCount;
        L1460_puc_Buffer = F0468_MEMORY_Allocate(L1459_l_ByteCount, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        for (L1457_ui_TrackIndex = 0; L1457_ui_TrackIndex < 80; L1457_ui_TrackIndex++) {
                if (Flopfmt(L1460_puc_Buffer, C0L_FILLER, G0574_i_SaveDiskFloppyDriveIndex, C9_SECTORS_PER_TRACK, L1457_ui_TrackIndex, C0_SIDE_0, C1_INTERLEAVE, C0x87654321_MAGIC, (L1457_ui_TrackIndex <= 1) ? 0 : 0xE5E5)) {
                        goto T0453006;
                }
        }
        Protobt(L1460_puc_Buffer, C0x01000001_SERIAL_RANDOM, C2_80_TRACKS_SINGLE_SIDED, C0_DISK_NOT_EXECUTABLE);
        if (Flopwr(L1460_puc_Buffer, C0L_FILLER, G0574_i_SaveDiskFloppyDriveIndex, C001_SECTOR_1, C0_TRACK_0, C0_SIDE_0, C1_ONE_SECTOR)) {
                T0453006:
                L1458_B_IsFormatDiskSuccessful = C0_FALSE;
        }
        F0469_MEMORY_FreeAtHeapTop(L1459_l_ByteCount);
        return L1458_B_IsFormatDiskSuccessful;
#endif
#ifdef MEDIA349_G14ED
        FormatRec L6452_;


        L6452_.devName = G4059_;
        L6452_.volName = G4062_;
        L6452_.fileSysID = 1;
        F2228_CallProDOS_FORMAT(&L6452_);
        if (_toolErr) {
                return C0_FALSE;
        } else {
                return C1_TRUE;
        }
#endif
#ifdef MEDIA388_G20E_G21E
        FormatRecGS L6408_;
        GSString255 L6409_;


        L6408_.pCount = 4;
        L6408_.devName = &G4004_s_;
        L6408_.volName = (GSString32Ptr)F2154_(G4006_ac_, &L6409_);
        L6408_.reqFileSysID = 1;
        Format(&L6408_);
        if (_toolErr || (L6408_.fileSysID != L6408_.reqFileSysID)) {
                return C0_FALSE;
        } else {
                return C1_TRUE;
        }
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
#ifdef MEDIA440_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
        REGISTER BOOLEAN L1458_B_IsFormatDiskSuccessful;
        REGISTER char* L1662_pc_String;


#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        L1458_B_IsFormatDiskSuccessful = C1_TRUE;
#endif
        L1662_pc_String = &G1061_pc_SaveDiskVolumeName[M544_STRLEN(G1061_pc_SaveDiskVolumeName) - 1];
        *L1662_pc_String = '\0';
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        if (!F0519_FLOPPY_GetFormatResult(G0574_i_SaveDiskFloppyDriveIndex, G1061_pc_SaveDiskVolumeName)) {
                L1458_B_IsFormatDiskSuccessful = C1_TRUE;
        } else {
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        if (F0519_FLOPPY_GetFormatResult(G0574_i_SaveDiskFloppyDriveIndex, G1061_pc_SaveDiskVolumeName)) {
#endif
                L1458_B_IsFormatDiskSuccessful = C0_FALSE;
        }
        *L1662_pc_String = ':';
        return L1458_B_IsFormatDiskSuccessful;
#endif
#ifdef MEDIA410_A20ED
        if (!F0519_FLOPPY_GetFormatResult(G0574_i_SaveDiskFloppyDriveIndex, G1061_pc_SaveDiskVolumeName)) {
                return C1_TRUE;
        } else {
                return C0_FALSE;
        }
#endif
#endif
#ifdef MEDIA607_X30J_X31J
        unsigned char* L2585_puc_;
        long L2586_l_;
        long L2587_l_;
        BOOLEAN L1458_B_IsFormatDiskSuccessful;
        char L2588_ac_[32];


        L2585_puc_ = F0468_MEMORY_Allocate(6144L, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        asm {
                        movem.l d3-d7/a2-a5,-(sp)
                        lea     L2588_ac_(a6),a0
                        move.l  #0x103,d1
                        moveq   #8,d0
                @Tloc_1FE8C:
                        move.l  d1,(a0)+
                        addi.w  #0x100,d1
                        subq.w  #1,d0
                        bne.s   @Tloc_1FE8C
                        move.l  #0x3000001,L2587_l_(a6)
                        clr.l   L2586_l_(a6)
                @Tloc_1FEA2:
                        moveq   #0x4D,d0         /* B_FORMAT */
                        move.w  #0x9170,d1
                        move.l  L2587_l_(a6),d2
                        moveq   #0x20,d3
                        lea     L2588_ac_(a6),a1
                        trap    #0xF             /* TRAP 15 (IOCS CALL) */
                        tst.l   d0
                        bmi.w   @Tloc_1FF1A
                        jsr     F1031_IsOperationSuccessful
                        beq.s   @Tloc_1FF1A
                        move.l  L2587_l_(a6),d2
                        eori.l  #0x100,d2
                        eori.l  #1,L2586_l_(a6)
                        bne.s   @Tloc_1FEDA
                        addi.l  #0x10000,d2
                @Tloc_1FEDA:
                        move.l  d2,L2587_l_(a6)
                        andi.l  #0xFF0000,d2
                        cmpi.l  #0x4D0000,d2
                        beq.s   @Tloc_1FF24
                        moveq   #0,d3
                        lea     L2588_ac_(a6),a1
                        move.b  L2587_l_+1(a6),d2
                @Tloc_1FEF6:
                        move.b  d2,(a1)
                        addq.l  #4,a1
                        addq.w  #1,d3
                        cmpi.w  #8,d3
                        bne.s   @Tloc_1FEF6
                        moveq   #0,d3
                        lea     L2588_ac_+1(a6),a1
                        move.b  L2587_l_+2(a6),d2
                @Tloc_1FF0C:
                        move.b  d2,(a1)
                        addq.l  #4,a1
                        addq.w  #1,d3
                        cmpi.w  #8,d3
                        bne.s   @Tloc_1FF0C
                        bra.s   @Tloc_1FEA2
                @Tloc_1FF1A:
                        move.w  #C0_FALSE,L1458_B_IsFormatDiskSuccessful(a6)
                        bra.w   @Tloc_2002C
                @Tloc_1FF24:
                        movea.l L2585_puc_(a6),a0
                        move.l  #0xFEFFFF00,(a0)+
                        move.w  #0x1FE,d2
                        moveq   #0,d0
                @Tloc_1FF34:
                        move.l  d0,(a0)+
                        dbf     d2,@Tloc_1FF34
                        move.w  #0x9170,d1
                        move.l  #0x3000002,d2
                        move.l  #0x800,d3
                        movea.l L2585_puc_(a6),a1
                        moveq   #0x45,d0         /* B_WRITE */
                        trap    #0xF             /* TRAP 15 (IOCS CALL) */
                        btst    #0x1E,d0
                        bne.s   @Tloc_1FF1A
                        btst    #0x15,d0
                        bne.s   @Tloc_1FF1A
                        btst    #0xD,d0
                        bne.s   @Tloc_1FF1A
                        move.w  #0x9170,d1
                        move.l  #0x3000004,d2
                        move.l  #0x800,d3
                        movea.l L2585_puc_(a6),a1
                        moveq   #0x45,d0         /* B_WRITE */
                        trap    #0xF             /* TRAP 15 (IOCS CALL) */
                        btst    #0x1E,d0
                        bne.s   @Tloc_1FF1A
                        btst    #0x15,d0
                        bne.s   @Tloc_1FF1A
                        btst    #0xD,d0
                        bne.s   @Tloc_1FF1A
                        movea.l L2585_puc_(a6),a0
                        move.w  #0x5FF,d2
                        moveq   #0,d1
                @Tloc_1FF98:
                        move.l  d1,(a0)+
                        dbf     d2,@Tloc_1FF98
                        move.w  #0x9170,d1
                        move.l  #0x3000006,d2
                        move.l  #0x1800,d3
                        movea.l L2585_puc_(a6),a1
                        moveq   #0x45,d0         /* B_WRITE */
                        trap    #0xF             /* TRAP 15 (IOCS CALL) */
                        btst    #0x1E,d0
                        bne.w   @Tloc_1FF1A
                        btst    #0x15,d0
                        bne.w   @Tloc_1FF1A
                        btst    #0xD,d0
                        bne.w   @Tloc_1FF1A
                        movea.l L2585_puc_(a6),a0
                        move.w  #0xFF,d2
                        moveq   #0,d0
                @Tloc_1FFD8:
                        move.l  d0,(a0)+
                        dbf     d2,@Tloc_1FFD8
                        lea     G3096_ac_SaveGameFloppyLabel(a5),a0
                        movea.l L2585_puc_(a6),a1
                @Tloc_1FFE6:
                        move.b  (a0)+,d0
                        beq.s   @Tloc_1FFEE
                        move.b  d0,(a1)+
                        bra.s   @Tloc_1FFE6
                @Tloc_1FFEE:
                        move.w  #0x9170,d1
                        move.l  #0x3000001,d2
                        move.l  #0x400,d3
                        movea.l L2585_puc_(a6),a1
                        moveq   #0x45,d0         /* B_WRITE */
                        trap    #0xF             /* TRAP 15 (IOCS CALL) */
                        btst    #0x1E,d0
                        bne.w   @Tloc_1FF1A
                        btst    #0x15,d0
                        bne.w   @Tloc_1FF1A
                        btst    #0xD,d0
                        bne.w   @Tloc_1FF1A
                        jsr     F1031_IsOperationSuccessful
                        beq.w   @Tloc_1FF1A
                        move.w  #C1_TRUE,L1458_B_IsFormatDiskSuccessful(a6)
                @Tloc_2002C:
                        movem.l (sp)+,d3-d7/a2-a5
        }
        F0469_MEMORY_FreeAtHeapTop(6144L);
        return L1458_B_IsFormatDiskSuccessful;
#endif
}
#endif

#ifdef MEDIA278_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE7_03_IMPROVEMENT Support for two floppy disk drives */
BOOLEAN F0454_FLOPPY_IsSaveDiskTypeInSaveDiskDrive(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0862_ui_SaveDiskType)
#endif
unsigned int16_t P0862_ui_SaveDiskType FINAL_SEPARATOR
{
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        BOOLEAN L2589_B_Result;


        switch (P0862_ui_SaveDiskType) {
                case C0_DISK_TYPE_GAME_DISK:
                case C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED:
                        if (F0452_FLOPPY_GetDiskTypeInDrive_CPSB(C2_DRIVE_TYPE_SAVE_DISK) == C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED) {
                                L2589_B_Result = C1_TRUE;
                        } else {
                                L2589_B_Result = C0_FALSE;
                        }
                        break;
                case C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED:
                        L2589_B_Result = C1_TRUE;
        }
        return L2589_B_Result;
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        BOOLEAN L2589_B_Result;
#endif
#ifdef MEDIA265_S20E_S21E
        REGISTER unsigned int16_t L1461_ui_Multiple;
#define AL1461_ui_DiskType    L1461_ui_Multiple
#define AL1461_ui_DriveLetter L1461_ui_Multiple


        if (P0862_ui_SaveDiskType == C2_SAVE_DISK_UNFORMATTED_DISK) {
                AL1461_ui_DiskType = C3_DISK_TYPE_UNFORMATTED_DISK;
        } else {
                G0569_pc_SavedGameFileName = G0575_ac_SavedGameFileName;
                G0570_pc_SavedGameBackupFileName = G0576_ac_SavedGameBackupFileName;
                if (G0567_B_GameAndSaveDiskUseSameDrive) {
                        AL1461_ui_DriveLetter = 'A';
                } else {
                        AL1461_ui_DriveLetter = 'B';
                }
                G0575_ac_SavedGameFileName[0] = AL1461_ui_DriveLetter;
                G0576_ac_SavedGameBackupFileName[0] = AL1461_ui_DriveLetter;
                AL1461_ui_DiskType = C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED;
        }
        if (F0452_FLOPPY_GetDiskTypeInDrive_CPSB(C2_DRIVE_TYPE_SAVE_DISK) == AL1461_ui_DiskType) {
                return C1_TRUE;
        }
        return C0_FALSE;
#endif
#ifdef MEDIA354_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_P20JA_P20JB_I34E_I34M_P31J
        switch (P0862_ui_SaveDiskType) {
                case C0_DISK_TYPE_GAME_DISK:
                case C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED:
#ifdef MEDIA351_G14ED_G20E_G21E
                        G0569_pc_SavedGameFileName = G4007_ac_;
                        G0570_pc_SavedGameBackupFileName = G4008_ac_;
#endif
                        if (F0452_FLOPPY_GetDiskTypeInDrive_CPSB(C2_DRIVE_TYPE_SAVE_DISK) == C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED) {
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                                return C1_TRUE;
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
                                L2589_B_Result = C1_TRUE;
                                break;
#endif
                        } else {
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                                return C0_FALSE;
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
                                L2589_B_Result = C0_FALSE;
                                break;
#endif
                        }
                        break;
                case C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED:
                        if (F0452_FLOPPY_GetDiskTypeInDrive_CPSB(C2_DRIVE_TYPE_SAVE_DISK) == C3_DISK_TYPE_UNFORMATTED_DISK) {
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                                return C1_TRUE;
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
                                L2589_B_Result = C1_TRUE;
                                break;
#endif
                        } else {
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                                return C0_FALSE;
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
                                L2589_B_Result = C0_FALSE;
                                break;
#endif
                        }
                        break;
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                default:
                        return C0_FALSE;
                        break;
#endif
        }
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        return L2589_B_Result;
#endif
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        return F0452_FLOPPY_GetDiskTypeInDrive_CPSB(C2_DRIVE_TYPE_SAVE_DISK) == ((P0862_ui_SaveDiskType == C2_SAVE_DISK_UNFORMATTED_DISK) ? C3_DISK_TYPE_UNFORMATTED_DISK : C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED);
#endif
}
#endif

#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
BOOLEAN F0453_FLOPPY_IsFormatDiskSuccessful(
)
{
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        F0716_CallRazAXInIBMIO(G2146_i_SaveDiskDriveOrdinal);
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        return C0_FALSE;
#endif
}
#endif

#ifdef MEDIA398_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
void F0528_FLOPPY_Eject(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P3088_i_DriveType)
#endif
int16_t P3088_i_DriveType FINAL_SEPARATOR
{
#ifdef MEDIA388_G20E_G21E
        DAccessRecGS L6410_;
        char L6411_[6];


        L6410_.pCount = 5;
        if (P3088_i_DriveType == C1_DRIVE_TYPE_GAME_DISK) {
                L6410_.devNum = G3989_i_GameDiskDrive;
        } else {
                L6410_.devNum = G3998_i_SaveDiskDrive;
        }
        L6410_.code = eject;
        L6410_.list = L6411_;
        L6410_.requestCount = 0;
        DControl(&L6410_);
#endif
#ifdef MEDIA607_X30J_X31J
        register int16_t L2590_i_DriveAddress;


        L2590_i_DriveAddress = (P3088_i_DriveType == C1_DRIVE_TYPE_GAME_DISK) ? 0x9000 : 0x9100; /* 0x90 for Drive 0, 0x91 for Drive 1 */
        asm {
                moveq   #0x4F,d0        /* B_EJECT */
                move.w  d7,d1           /* d7 = L2590_i_DriveAddress */
                trap    #0xF            /* TRAP 15 (IOCS CALL) */
        }
        G3091_i_ErrorCount = 0;
#endif
}
#endif

#ifdef MEDIA394_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
BOOLEAN F0529_FLOPPY_IsFloppyInDrive(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0961_i_DriveType)
#endif
int16_t P0961_i_DriveType FINAL_SEPARATOR
{
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER BOOLEAN L1722_B_FloppyWriteProtectionState;
        REGISTER BOOLEAN* L1723_pB_;
        int16_t L1724_i_FloppyDriveIndex;


        if (P0961_i_DriveType == C1_DRIVE_TYPE_GAME_DISK) {
                if (G1092_B_GameDiskDriveNotEmpty && ((G1086_VerticalBlankCount - G1084_l_GameDiskChangeVerticalBlankCount) > 240)) {
                        return C0_FALSE;
                }
                L1723_pB_ = &G1092_B_GameDiskDriveNotEmpty;
                L1724_i_FloppyDriveIndex = 0;
        } else {
                if (P0961_i_DriveType == C2_DRIVE_TYPE_SAVE_DISK) {
                        if (G1093_B_SaveDiskDriveNotEmpty && ((G1086_VerticalBlankCount - G1085_l_SaveDiskChangeVerticalBlankCount) > 240)) {
                                return C0_FALSE;
                        }
                        L1723_pB_ = &G1093_B_SaveDiskDriveNotEmpty;
                        L1724_i_FloppyDriveIndex = G0574_i_SaveDiskFloppyDriveIndex;
                } else {
                        return C0_FALSE;
                }
        }
        L1722_B_FloppyWriteProtectionState = F0525_FLOPPY_GetWriteProtectionState(L1724_i_FloppyDriveIndex);
        if (L1722_B_FloppyWriteProtectionState == C0_FALSE) { /* No disk in drive */
                *L1723_pB_ = C0_FALSE;
                return C0_FALSE;
        }
        *L1723_pB_ = C1_TRUE;
        return C1_TRUE;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        register BOOLEAN L1722_B_FloppyWriteProtectionState;


        L1722_B_FloppyWriteProtectionState = C0_FALSE;
        if (P0961_i_DriveType) {
                if ((P0961_i_DriveType == C1_DRIVE_TYPE_GAME_DISK) && G3179_B_GameDiskChanged) {
                        L1722_B_FloppyWriteProtectionState = (F1109_GetDiskState(G0573_i_GameDiskFloppyDriveIndex) && G3179_B_GameDiskChanged);
                        G3179_B_GameDiskChanged = C0_FALSE;
                } else {
                        if ((P0961_i_DriveType == C2_DRIVE_TYPE_SAVE_DISK) && G3180_B_SaveDiskChanged) {
                                L1722_B_FloppyWriteProtectionState = (F1109_GetDiskState(G0574_i_SaveDiskFloppyDriveIndex) && G3180_B_SaveDiskChanged);
                                G3180_B_SaveDiskChanged = C0_FALSE;
                        }
                }
        }
        return L1722_B_FloppyWriteProtectionState;
#endif
#ifdef MEDIA402_G20E_G21E_P20JA_P20JB_I34E_I34M_P31J
        return C0_FALSE;
#endif
#ifdef MEDIA607_X30J_X31J
        if (P0961_i_DriveType == 0) {
                return C0_FALSE;
        }
        return (F1025_GetFloppyDriveStatus((P0961_i_DriveType == 1) ? 0x90 : 0x91) != 2); /* 0x90 for Drive 0, 0x91 for Drive 1 */
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        return C0_FALSE;
#endif
}
#endif

#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
#include "FILE.C"
#endif

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
BOOLEAN F0530_FLOPPY_DirectoryExists(
P0962_pc_Name, P5903_)
char* P0962_pc_Name SEPARATOR
int16_t P5903_      FINAL_SEPARATOR
{
        REGISTER int16_t L1725_i_Result;
        REGISTER struct FileLock* L1726_ps_Lock;


        L1725_i_Result = C0_FALSE;
        L1726_ps_Lock = Lock(P0962_pc_Name, ACCESS_READ);
        if (L1726_ps_Lock == NULL) {
                L1725_i_Result = C0_FALSE;
        } else {
                L1725_i_Result = C1_TRUE;
                UnLock(L1726_ps_Lock);
        }
        return L1725_i_Result;
}

int16_t F0531_FLOPPY_CompareVolumeName(
P0963_pc_String1, P0964_pc_String2)
REGISTER char* P0963_pc_String1 SEPARATOR
REGISTER char* P0964_pc_String2 FINAL_SEPARATOR
{
        REGISTER int16_t L1727_i_;


        L1727_i_ = strlen(P0963_pc_String1);
        if (*P0964_pc_String2 != L1727_i_) {
                return 0;
        }
        if (!strncmp(P0963_pc_String1, P0964_pc_String2 + 1, L1727_i_)) {
                return C1_TRUE;
        } else {
                return C0_FALSE;
        }
}

#ifdef MEDIA410_A20ED
struct InfoData* F0532_FLOPPY_GetVolumeInfoData(
P0966_i_UnitNumber)
int16_t P0966_i_UnitNumber FINAL_SEPARATOR
{
        REGISTER int16_t L1728_i_Useless;
        REGISTER char* L1729_pc_Lock;


        L1728_i_Useless = 0;
        G1032_auc_DriveDeviceName[2] = P0966_i_UnitNumber + '0';
        L1729_pc_Lock = (char*)Lock(G1032_auc_DriveDeviceName, ACCESS_READ);
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
BOOLEAN F0532_FLOPPY_GetVolumeInfoData(
P0965_pc_Name, P0966_i_UnitNumber)
char*   P0965_pc_Name      SEPARATOR
int16_t P0966_i_UnitNumber FINAL_SEPARATOR
{
        char* L1729_pc_Lock;


        L1729_pc_Lock = (char*)Lock(P0965_pc_Name, ACCESS_READ);
#endif
        if (!L1729_pc_Lock) {
                return C0_FALSE;
        }
        if (!Info(L1729_pc_Lock, G1087_ps_VolumeInfoData)) {
                UnLock(L1729_pc_Lock);
                return C0_FALSE;
        }
        UnLock(L1729_pc_Lock);
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        if (P0966_i_UnitNumber == G1087_ps_VolumeInfoData->id_UnitNumber) {
                return C1_TRUE;
        }
        return C0_FALSE;
#endif
#ifdef MEDIA410_A20ED
        return G1087_ps_VolumeInfoData;
#endif
}

int16_t F0533_FLOPPY_WriteSavedGameInfoFiles(
)
{
        REGISTER FILE_HANDLE L1730_ps_File;
        static char G1090_ac_SavedGameInfoFileName[64];
        static char G1091_ac_SavedGameInfoFileContent[1668] = {
                0xE3, 0x10,             /* DiskObject.do_Magic */
                0x00, 0x01,             /* DiskObject.do_Version */
                0x00, 0x00, 0x00, 0x00, /* DiskObject.do_Gadget.NextGadget */
                0x00, 0x25,             /* DiskObject.do_Gadget.LeftEdge */
                0x00, 0x32,             /* DiskObject.do_Gadget.TopEdge */
                0x00, 0x54,             /* DiskObject.do_Gadget.Width */
                0x00, 0x20,             /* DiskObject.do_Gadget.Height */
                0x00, 0x06,             /* DiskObject.do_Gadget.Flags */
                0x00, 0x03,             /* DiskObject.do_Gadget.Activation */
                0x00, 0x01,             /* DiskObject.do_Gadget.GadgetType */
                0x00, 0x21, 0xC8, 0x28, /* DiskObject.do_Gadget.GadgetRender */
                0x00, 0x22, 0x25, 0x50, /* DiskObject.do_Gadget.SelectRender */
                0x00, 0xC3, 0xB3, 0x30, /* DiskObject.do_Gadget.GadgetText */
                0x00, 0x00, 0x00, 0x00, /* DiskObject.do_Gadget.MutualExclude */
                0x00, 0x00, 0x00, 0x00, /* DiskObject.do_Gadget.SpecialInfo */
                0x00, 0x00,             /* DiskObject.do_Gadget.GadgetID */
                0x00, 0x00, 0x00, 0x00, /* DiskObject.do_Gadget.UserData  */
                0x04,                   /* DiskObject.do_Type */
                0x22,                   /* padding */
                0x00, 0x20, 0x3B, 0xD8, /* DiskObject.do_DefaultTool */
                0x00, 0x20, 0x3B, 0xE0, /* DiskObject.do_ToolTypes */
                0x80, 0x00, 0x00, 0x00, /* DiskObject.do_CurrentX */
                0x80, 0x00, 0x00, 0x00, /* DiskObject.do_CurrentY */
                0x00, 0x00, 0x00, 0x00, /* DiskObject.do_DrawerData */
                0x00, 0x00, 0x00, 0x00, /* DiskObject.do_ToolWindow */
                0x00, 0x00, 0x0F, 0xA0, /* DiskObject.do_StackSize */

                0x00, 0x00,             /* Image.LeftEdge */
                0x00, 0x00,             /* Image.TopEdge */
                0x00, 0x54,             /* Image.Width */
                0x00, 0x20,             /* Image.Height */
                0x00, 0x02,             /* Image.Depth */
                0x00, 0x01, 0x8B, 0xF8, /* Image.ImageData */
                0x03,                   /* Image.PlanePick */
                0x00,                   /* Image.PlaneOnOff */
                0x00, 0x00, 0x00, 0x00, /* Image.NextImage */
                /* Raster data for image 1 */
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x0F, 0xFC, 0xFF, 0xFC, 0xFF, 0x3F, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0x3F, 0xC3, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0xFF, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0xC0, 0x03, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0xCF, 0xC3, 0xFF, 0xFC, 0x0F, 0xFF, 0xFF, 0x3F, 0xFF, 0xC0, 0x00,
                0x00, 0xC3, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0xC3, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0xCF, 0xC3, 0xFF, 0xFC, 0x0F, 0xFF, 0xFC, 0x0F, 0xFC, 0xC0, 0x00,
                0x00, 0xC0, 0x03, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0x0F, 0xFC, 0xC0, 0x00,
                0x00, 0xFF, 0x03, 0xF0, 0xFF, 0xFF, 0xFC, 0xFF, 0xCF, 0xFF, 0xC0, 0x00,
                0x00, 0x3F, 0xC3, 0xFC, 0xFF, 0xFF, 0xFC, 0xFF, 0xCF, 0xFF, 0xC0, 0x00,
                0x00, 0x00, 0x0F, 0xF0, 0xFF, 0xCF, 0xFC, 0xF3, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

                0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00,
                0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00,
                0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
                0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

                0x00, 0x00,             /* Image.LeftEdge */
                0x00, 0x00,             /* Image.TopEdge */
                0x00, 0x54,             /* Image.Width */
                0x00, 0x20,             /* Image.Height */
                0x00, 0x02,             /* Image.Depth */
                0x00, 0x01, 0x91, 0x60, /* Image.ImageData */
                0x03,                   /* Image.PlanePick */
                0x00,                   /* Image.PlaneOnOff */
                0x00, 0x00, 0x00, 0x00, /* Image.NextImage */
                /* Raster data for image 2 */
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x0F, 0xFC, 0xFF, 0xFC, 0xFF, 0x3F, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0x3F, 0xC3, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0xFF, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0xC0, 0x03, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
                0x00, 0xCF, 0xC3, 0xFF, 0xFC, 0x0F, 0xFF, 0xFF, 0x3F, 0xFF, 0xC0, 0x00,
                0x00, 0xC3, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
                0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
                0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00,
                0x00, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00,
                0x00, 0x3F, 0x3F, 0x00, 0x30, 0x0F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00,
                0x00, 0x0C, 0x3C, 0x00, 0x30, 0x00, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00,
                0x00, 0x00, 0x0F, 0xFC, 0xFF, 0x00, 0x3F, 0xFF, 0xFB, 0xC0, 0x00, 0x00,
                0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xF8, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFC, 0x0F, 0xFF, 0xFE, 0x00, 0x00, 0x00,
                0x00, 0x30, 0x00, 0x03, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0xC0, 0x00, 0x00,
                0x00, 0x3F, 0xC0, 0x00, 0xC7, 0xFF, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
                0x00, 0x0F, 0xFF, 0xFF, 0xC7, 0xFF, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
                0x00, 0x03, 0xFF, 0xFF, 0xC7, 0xFF, 0x0F, 0xFB, 0xFF, 0xF0, 0x00, 0x00,
                0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFC, 0x7F, 0xF3, 0xCF, 0xF0, 0x00, 0x00,
                0x00, 0x03, 0xFF, 0xFF, 0xF9, 0xF7, 0xF3, 0xFF, 0x3F, 0xF0, 0x00, 0x00,
                0x00, 0x03, 0x80, 0x0F, 0xC1, 0xFF, 0xC3, 0xF3, 0x3F, 0xF0, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x3F, 0xF3, 0xF8, 0x0F, 0xCC, 0xFF, 0xF0, 0x00, 0x00,
                0x00, 0x03, 0xFF, 0xFF, 0xEF, 0xC1, 0xBC, 0xFC, 0xFF, 0xE0, 0x00, 0x00,
                0x00, 0x03, 0xFF, 0xFF, 0x8C, 0x3F, 0xF3, 0xF3, 0xFF, 0x3E, 0x00, 0x00,
                0x03, 0xF3, 0xFF, 0xFF, 0xBF, 0xFD, 0xFF, 0xF3, 0xC0, 0xF0, 0x00, 0x00,
                0x30, 0xF3, 0xFF, 0xFF, 0x3F, 0xF7, 0xFF, 0xC0, 0x03, 0xF0, 0x00, 0x00,
                0x3C, 0x03, 0xFF, 0xFE, 0xFF, 0xF3, 0xFF, 0xC3, 0xFF, 0xC0, 0x00, 0x00,
                0x0F, 0xC3, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

                0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00,
                0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00,
                0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00,
                0x03, 0xFF, 0xFF, 0xC0, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00,
                0x03, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xF8, 0x00, 0x00,
                0x03, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xE0, 0x00, 0x00,
                0x00, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xF8, 0x00, 0x00,
                0x00, 0xFF, 0xC0, 0xFF, 0xCF, 0xF0, 0x00, 0xFF, 0xFF, 0xF8, 0x00, 0x00,
                0x00, 0x3F, 0xC3, 0xFF, 0xCF, 0xFF, 0x00, 0x3F, 0xFF, 0xF8, 0x00, 0x00,
                0x00, 0x3F, 0xF3, 0xFF, 0x0C, 0xFF, 0xC0, 0x3F, 0xFB, 0xF8, 0x00, 0x00,
                0x00, 0x0F, 0xF0, 0x00, 0x00, 0x3F, 0xF0, 0x3F, 0xF8, 0xE0, 0x00, 0x00,
                0x00, 0x00, 0xFC, 0x00, 0x00, 0x0F, 0xF0, 0x3F, 0xFE, 0x00, 0x00, 0x00,
                0x00, 0x3E, 0xFF, 0xFC, 0x00, 0x3F, 0xF0, 0x7F, 0xFF, 0xFE, 0x00, 0x00,
                0x00, 0x3F, 0xFF, 0xFF, 0x3C, 0xFF, 0xF0, 0xF3, 0xFF, 0x3E, 0x00, 0x00,
                0x00, 0x3F, 0xF0, 0x00, 0x3F, 0xCF, 0xF0, 0x03, 0xF0, 0xFE, 0x00, 0x00,
                0x00, 0x0F, 0xC0, 0x00, 0x3C, 0x0F, 0xF0, 0x07, 0x00, 0xFE, 0x00, 0x00,
                0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x0C, 0x33, 0xFE, 0x00, 0x00,
                0x00, 0x0C, 0x00, 0x00, 0x06, 0x08, 0x0C, 0x00, 0xC3, 0xFE, 0x00, 0x00,
                0x00, 0x0C, 0x3F, 0xF0, 0x3E, 0x00, 0x3C, 0x0F, 0xCF, 0xFE, 0x00, 0x00,
                0x00, 0x00, 0xFF, 0xC3, 0xFC, 0x07, 0xF0, 0x3F, 0x0F, 0x0E, 0x00, 0x00,
                0x00, 0x0F, 0xFF, 0x8F, 0xF0, 0x3F, 0xC3, 0xFF, 0x3C, 0x00, 0x00, 0x00,
                0x3F, 0xFF, 0xFF, 0x7F, 0xF3, 0xFF, 0x0F, 0xFC, 0x00, 0xFE, 0x00, 0x00,
                0xFF, 0xFF, 0xFE, 0xFF, 0xC3, 0xFE, 0x3F, 0xFC, 0x3F, 0xFE, 0x00, 0x00,
                0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xF8, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00,
                0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00,
                0xEF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00,
                0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0x3F, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00,

                0x00, 0x00, 0x00, 0x01, 0x00, /* DefaultTool */
                0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00 /* ToolTypes */
        }; /* .info file content */


        strcpy(G1090_ac_SavedGameInfoFileName, G0570_pc_SavedGameBackupFileName);
        strcat(G1090_ac_SavedGameInfoFileName, ".info");
        L1730_ps_File = Open(G1090_ac_SavedGameInfoFileName, MODE_NEWFILE);
        if (L1730_ps_File == NULL) {
                return 0;
        }
        Write(L1730_ps_File, G1091_ac_SavedGameInfoFileContent, (long)sizeof(G1091_ac_SavedGameInfoFileContent)) == (long)sizeof(G1091_ac_SavedGameInfoFileContent);
        M572_CloseFile(L1730_ps_File);
        strcpy(G1090_ac_SavedGameInfoFileName, G0569_pc_SavedGameFileName);
        strcat(G1090_ac_SavedGameInfoFileName, ".info");
        L1730_ps_File = Open(G1090_ac_SavedGameInfoFileName, MODE_NEWFILE);
        if (L1730_ps_File == NULL) {
                return 0;
        }
        Write(L1730_ps_File, G1091_ac_SavedGameInfoFileContent, (long)sizeof(G1091_ac_SavedGameInfoFileContent)) == (long)sizeof(G1091_ac_SavedGameInfoFileContent);
        M572_CloseFile(L1730_ps_File);
}

long F0534_FLOPPY_GetFileSize(
P0967_l_File)
BPTR P0967_l_File FINAL_SEPARATOR
{
        REGISTER long L1731_l_;
        REGISTER long L1732_l_;


        L1731_l_ = Seek(P0967_l_File, 0L, OFFSET_END);
        L1732_l_ = Seek(P0967_l_File, L1731_l_, OFFSET_BEGINNING);
        return L1732_l_;
}
#endif

#ifdef MEDIA607_X30J_X31J
#include "IO2.C"
#include "COPYPRO6.C"
#include "COPYPRO7.C"
#include "COPYPRO5.C"
#endif
#endif
