Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

main.cpp

Go to the documentation of this file.
00001 /*
00002  *  main.cpp - Main program
00003  *
00004  *  Frodo (C) 1994-1997 Christian Bauer
00005  */
00006 
00007 #include "sysdeps.h"
00008 
00009 #include "main.h"
00010 #include "C64.h"
00011 #include "Display.h"
00012 #include "Prefs.h"
00013 #include "SAM.h"
00014 
00015 #ifdef __SYMBIAN32__
00016 #include <e32base.h>
00017 #include "e32frodo.h"
00018 #endif
00019 
00020 
00024 #if defined(__riscos__)
00025 #define BASIC_ROM_FILE  "FrodoRsrc:Basic_ROM"
00026 #define KERNAL_ROM_FILE "FrodoRsrc:Kernal_ROM"
00027 #define CHAR_ROM_FILE   "FrodoRsrc:Char_ROM"
00028 #define FLOPPY_ROM_FILE "FrodoRsrc:1541_ROM"
00029 #elif defined(__SYMBIAN32__)
00030 #define BASIC_ROM_FILE  "rom\\basic.rom"
00031 #define KERNAL_ROM_FILE "rom\\kernal.rom"
00032 #define CHAR_ROM_FILE   "rom\\char.rom"
00033 #define FLOPPY_ROM_FILE "rom\\1541.rom"
00034 #else
00035 #define BASIC_ROM_FILE  "basic.rom"
00036 #define KERNAL_ROM_FILE "kernal.rom"
00037 #define CHAR_ROM_FILE   "char.rom"
00038 #define FLOPPY_ROM_FILE "1541.rom"
00039 #endif
00040 
00041 
00042 static void MakePath(char* aPathBuf, const char* aFileName)
00046         {
00047 #ifdef __SYMBIAN32__
00048         TBuf8<KMaxFileName> driveAndPath;
00049         driveAndPath.Copy(((CE32FrodoApplication*)CEikonEnv::Static()->EikAppUi()->Application())->GetDriveAndPath());
00050         TPtrC8 fileName((TText8*)aFileName);
00051         driveAndPath.Append(fileName);
00052         driveAndPath.ZeroTerminate();
00053         Mem::Copy(aPathBuf,driveAndPath.Ptr(),driveAndPath.Length()+1);
00054 #else
00055         strcpy(aPathBuf, aFileName);
00057 #endif
00058         }
00059 
00060 
00061 #ifndef __PSXOS__
00062 bool Frodo::load_rom_files(void)
00066 {
00067         FILE *file;
00068 
00069         ELOG1(_L8("loading ROMs..."));
00070 
00071         // Load Basic.rom
00072 
00073         char fileName[128];
00074         MakePath(fileName,BASIC_ROM_FILE);
00075         if ((file = fopen(fileName, "rb")) != NULL) {
00076                 if (fread(TheC64->Basic, 1, 0x2000, file) != 0x2000) {
00077                         ShowRequester("Can't read 'basic.rom'.", "Quit");
00078                         return false;
00079                 }
00080                 fclose(file);
00081         } else {
00082                 ShowRequester("Can't find 'basic.rom'.", "Quit");
00083                 return false;
00084         }
00085 
00086         // Load Kernal ROM
00087         MakePath(fileName,KERNAL_ROM_FILE);
00088         if ((file = fopen(fileName, "rb")) != NULL) {
00089                 if (fread(TheC64->Kernal, 1, 0x2000, file) != 0x2000) {
00090                         ShowRequester("Can't read 'Kernal ROM'.", "Quit");
00091                         return false;
00092                 }
00093                 fclose(file);
00094         } else {
00095                 ShowRequester("Can't find 'Kernal ROM'.", "Quit");
00096                 return false;
00097         }
00098 
00099         // Load Char.rom
00100         MakePath(fileName,CHAR_ROM_FILE);
00101         if ((file = fopen(fileName, "rb")) != NULL) {
00102                 if (fread(TheC64->Char, 1, 0x1000, file) != 0x1000) {
00103                         ShowRequester("Can't read 'Char ROM'.", "Quit");
00104                         return false;
00105                 }
00106                 fclose(file);
00107         } else {
00108                 ShowRequester("Can't find 'Char ROM'.", "Quit");
00109                 return false;
00110         }
00111 
00112         // Load 1541.rom
00113         MakePath(fileName,FLOPPY_ROM_FILE);
00114         if ((file = fopen(fileName, "rb")) != NULL) {
00115                 if (fread(TheC64->ROM1541, 1, 0x4000, file) != 0x4000) {
00116                         ShowRequester("Can't read '1541 ROM'.", "Quit");
00117                         return false;
00118                 }
00119                 fclose(file);
00120         } else {
00121                 ShowRequester("Can't find '1541 ROM'.", "Quit");
00122                 return false;
00123         }
00124 
00125         ELOG1(_L8("[  OK  ]\n"));
00126 
00127         return true;
00128 }
00129 #endif
00130 
00131 
00132 #ifdef __BEOS__
00133 #include "main_Be.i"
00134 #endif
00135 
00136 #ifdef AMIGA
00137 #include "main_Amiga.i"
00138 #endif
00139 
00140 #ifdef __unix
00141 #include "main_x.i"
00142 #endif
00143 
00144 #ifdef __mac__
00145 #include "main_mac.i"
00146 #endif
00147 
00148 #ifdef WIN32
00149 #include "main_WIN32.i"
00150 #endif
00151 
00152 #ifdef __riscos__
00153 #include "main_Acorn.i"
00154 #endif
00155 
00156 #ifdef __PSXOS__
00157 #include "main_PSX.i"
00158 #endif
00159 
00160 #ifdef __SYMBIAN32__
00161 #include "main_epoc32.i"
00162 #endif

Generated on Tue Feb 8 04:07:57 2005 for E32frodo by doxygen 1.3.3