1 |
/* |
2 |
* main.cpp - Main program |
3 |
* |
4 |
* Frodo (C) 1994-1997,2002-2003 Christian Bauer |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
#include "sysdeps.h" |
22 |
|
23 |
#include "main.h" |
24 |
#include "C64.h" |
25 |
#include "Display.h" |
26 |
#include "Prefs.h" |
27 |
#include "SAM.h" |
28 |
|
29 |
|
30 |
// Global variables |
31 |
char AppDirPath[1024]; // Path of application directory |
32 |
|
33 |
|
34 |
// ROM file names |
35 |
#ifdef __riscos__ |
36 |
#define BASIC_ROM_FILE "FrodoRsrc:Basic_ROM" |
37 |
#define KERNAL_ROM_FILE "FrodoRsrc:Kernal_ROM" |
38 |
#define CHAR_ROM_FILE "FrodoRsrc:Char_ROM" |
39 |
#define FLOPPY_ROM_FILE "FrodoRsrc:1541_ROM" |
40 |
#else |
41 |
#define BASIC_ROM_FILE "Basic ROM" |
42 |
#define KERNAL_ROM_FILE "Kernal ROM" |
43 |
#define CHAR_ROM_FILE "Char ROM" |
44 |
#define FLOPPY_ROM_FILE "1541 ROM" |
45 |
#endif |
46 |
|
47 |
|
48 |
/* |
49 |
* Load C64 ROM files |
50 |
*/ |
51 |
|
52 |
bool Frodo::load_rom_files(void) |
53 |
{ |
54 |
FILE *file; |
55 |
|
56 |
// Load Basic ROM |
57 |
if ((file = fopen(BASIC_ROM_FILE, "rb")) != NULL) { |
58 |
if (fread(TheC64->Basic, 1, 0x2000, file) != 0x2000) { |
59 |
ShowRequester("Can't read 'Basic ROM'.", "Quit"); |
60 |
return false; |
61 |
} |
62 |
fclose(file); |
63 |
} else { |
64 |
ShowRequester("Can't find 'Basic ROM'.", "Quit"); |
65 |
return false; |
66 |
} |
67 |
|
68 |
// Load Kernal ROM |
69 |
if ((file = fopen(KERNAL_ROM_FILE, "rb")) != NULL) { |
70 |
if (fread(TheC64->Kernal, 1, 0x2000, file) != 0x2000) { |
71 |
ShowRequester("Can't read 'Kernal ROM'.", "Quit"); |
72 |
return false; |
73 |
} |
74 |
fclose(file); |
75 |
} else { |
76 |
ShowRequester("Can't find 'Kernal ROM'.", "Quit"); |
77 |
return false; |
78 |
} |
79 |
|
80 |
// Load Char ROM |
81 |
if ((file = fopen(CHAR_ROM_FILE, "rb")) != NULL) { |
82 |
if (fread(TheC64->Char, 1, 0x1000, file) != 0x1000) { |
83 |
ShowRequester("Can't read 'Char ROM'.", "Quit"); |
84 |
return false; |
85 |
} |
86 |
fclose(file); |
87 |
} else { |
88 |
ShowRequester("Can't find 'Char ROM'.", "Quit"); |
89 |
return false; |
90 |
} |
91 |
|
92 |
// Load 1541 ROM |
93 |
if ((file = fopen(FLOPPY_ROM_FILE, "rb")) != NULL) { |
94 |
if (fread(TheC64->ROM1541, 1, 0x4000, file) != 0x4000) { |
95 |
ShowRequester("Can't read '1541 ROM'.", "Quit"); |
96 |
return false; |
97 |
} |
98 |
fclose(file); |
99 |
} else { |
100 |
ShowRequester("Can't find '1541 ROM'.", "Quit"); |
101 |
return false; |
102 |
} |
103 |
|
104 |
return true; |
105 |
} |
106 |
|
107 |
|
108 |
#ifdef __BEOS__ |
109 |
#include "main_Be.h" |
110 |
#endif |
111 |
|
112 |
#ifdef AMIGA |
113 |
#include "main_Amiga.h" |
114 |
#endif |
115 |
|
116 |
#ifdef __unix |
117 |
#include "main_x.h" |
118 |
#endif |
119 |
|
120 |
#ifdef __mac__ |
121 |
#include "main_mac.h" |
122 |
#endif |
123 |
|
124 |
#ifdef WIN32 |
125 |
#include "main_WIN32.h" |
126 |
#endif |
127 |
|
128 |
#ifdef __riscos__ |
129 |
#include "main_Acorn.h" |
130 |
#endif |