1 |
cebix |
1.1 |
/* |
2 |
|
|
* main.cpp - Main program |
3 |
|
|
* |
4 |
|
|
* Frodo (C) 1994-1997,2002 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 |
|
|
#ifndef __PSXOS__ |
53 |
|
|
bool Frodo::load_rom_files(void) |
54 |
|
|
{ |
55 |
|
|
FILE *file; |
56 |
|
|
|
57 |
|
|
// Load Basic ROM |
58 |
|
|
if ((file = fopen(BASIC_ROM_FILE, "rb")) != NULL) { |
59 |
|
|
if (fread(TheC64->Basic, 1, 0x2000, file) != 0x2000) { |
60 |
|
|
ShowRequester("Can't read 'Basic ROM'.", "Quit"); |
61 |
|
|
return false; |
62 |
|
|
} |
63 |
|
|
fclose(file); |
64 |
|
|
} else { |
65 |
|
|
ShowRequester("Can't find 'Basic ROM'.", "Quit"); |
66 |
|
|
return false; |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
// Load Kernal ROM |
70 |
|
|
if ((file = fopen(KERNAL_ROM_FILE, "rb")) != NULL) { |
71 |
|
|
if (fread(TheC64->Kernal, 1, 0x2000, file) != 0x2000) { |
72 |
|
|
ShowRequester("Can't read 'Kernal ROM'.", "Quit"); |
73 |
|
|
return false; |
74 |
|
|
} |
75 |
|
|
fclose(file); |
76 |
|
|
} else { |
77 |
|
|
ShowRequester("Can't find 'Kernal ROM'.", "Quit"); |
78 |
|
|
return false; |
79 |
|
|
} |
80 |
|
|
|
81 |
|
|
// Load Char ROM |
82 |
|
|
if ((file = fopen(CHAR_ROM_FILE, "rb")) != NULL) { |
83 |
|
|
if (fread(TheC64->Char, 1, 0x1000, file) != 0x1000) { |
84 |
|
|
ShowRequester("Can't read 'Char ROM'.", "Quit"); |
85 |
|
|
return false; |
86 |
|
|
} |
87 |
|
|
fclose(file); |
88 |
|
|
} else { |
89 |
|
|
ShowRequester("Can't find 'Char ROM'.", "Quit"); |
90 |
|
|
return false; |
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
// Load 1541 ROM |
94 |
|
|
if ((file = fopen(FLOPPY_ROM_FILE, "rb")) != NULL) { |
95 |
|
|
if (fread(TheC64->ROM1541, 1, 0x4000, file) != 0x4000) { |
96 |
|
|
ShowRequester("Can't read '1541 ROM'.", "Quit"); |
97 |
|
|
return false; |
98 |
|
|
} |
99 |
|
|
fclose(file); |
100 |
|
|
} else { |
101 |
|
|
ShowRequester("Can't find '1541 ROM'.", "Quit"); |
102 |
|
|
return false; |
103 |
|
|
} |
104 |
|
|
|
105 |
|
|
return true; |
106 |
|
|
} |
107 |
|
|
#endif |
108 |
|
|
|
109 |
|
|
|
110 |
|
|
#ifdef __BEOS__ |
111 |
|
|
#include "main_Be.h" |
112 |
|
|
#endif |
113 |
|
|
|
114 |
|
|
#ifdef AMIGA |
115 |
|
|
#include "main_Amiga.h" |
116 |
|
|
#endif |
117 |
|
|
|
118 |
|
|
#ifdef __unix |
119 |
|
|
#include "main_x.h" |
120 |
|
|
#endif |
121 |
|
|
|
122 |
|
|
#ifdef __mac__ |
123 |
|
|
#include "main_mac.h" |
124 |
|
|
#endif |
125 |
|
|
|
126 |
|
|
#ifdef WIN32 |
127 |
|
|
#include "main_WIN32.h" |
128 |
|
|
#endif |
129 |
|
|
|
130 |
|
|
#ifdef __riscos__ |
131 |
|
|
#include "main_Acorn.h" |
132 |
|
|
#endif |