ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/Frodo4/Src/main.cpp
Revision: 1.4
Committed: 2003-07-01T19:04:37Z (19 years, 7 months ago) by cebix
Branch: MAIN
Changes since 1.3: +8 -4 lines
Log Message:
ROMs are in /usr/share/frodo under Unix

File Contents

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