1 /*
2 * main.cpp - Main program
3 *
4 * Frodo (C) 1994-1997,2002 Christian Bauer
5 */
6
7 #include "sysdeps.h"
8
9 #include "main.h"
10 #include "C64.h"
11 #include "Display.h"
12 #include "Prefs.h"
13 #include "SAM.h"
14
15
16 // Global variables
17 char AppDirPath[1024]; // Path of application directory
18
19
20 // ROM file names
21 #ifdef __riscos__
22 #define BASIC_ROM_FILE "FrodoRsrc:Basic_ROM"
23 #define KERNAL_ROM_FILE "FrodoRsrc:Kernal_ROM"
24 #define CHAR_ROM_FILE "FrodoRsrc:Char_ROM"
25 #define FLOPPY_ROM_FILE "FrodoRsrc:1541_ROM"
26 #else
27 #define BASIC_ROM_FILE "Basic ROM"
28 #define KERNAL_ROM_FILE "Kernal ROM"
29 #define CHAR_ROM_FILE "Char ROM"
30 #define FLOPPY_ROM_FILE "1541 ROM"
31 #endif
32
33
34 /*
35 * Load C64 ROM files
36 */
37
38 #ifndef __PSXOS__
load_rom_files(void)39 bool Frodo::load_rom_files(void)
40 {
41 FILE *file;
42
43 // Load Basic ROM
44 if ((file = fopen(BASIC_ROM_FILE, "rb")) != NULL) {
45 if (fread(TheC64->Basic, 1, 0x2000, file) != 0x2000) {
46 ShowRequester("Can't read 'Basic ROM'.", "Quit");
47 return false;
48 }
49 fclose(file);
50 } else {
51 ShowRequester("Can't find 'Basic ROM'.", "Quit");
52 return false;
53 }
54
55 // Load Kernal ROM
56 if ((file = fopen(KERNAL_ROM_FILE, "rb")) != NULL) {
57 if (fread(TheC64->Kernal, 1, 0x2000, file) != 0x2000) {
58 ShowRequester("Can't read 'Kernal ROM'.", "Quit");
59 return false;
60 }
61 fclose(file);
62 } else {
63 ShowRequester("Can't find 'Kernal ROM'.", "Quit");
64 return false;
65 }
66
67 // Load Char ROM
68 if ((file = fopen(CHAR_ROM_FILE, "rb")) != NULL) {
69 if (fread(TheC64->Char, 1, 0x1000, file) != 0x1000) {
70 ShowRequester("Can't read 'Char ROM'.", "Quit");
71 return false;
72 }
73 fclose(file);
74 } else {
75 ShowRequester("Can't find 'Char ROM'.", "Quit");
76 return false;
77 }
78
79 // Load 1541 ROM
80 if ((file = fopen(FLOPPY_ROM_FILE, "rb")) != NULL) {
81 if (fread(TheC64->ROM1541, 1, 0x4000, file) != 0x4000) {
82 ShowRequester("Can't read '1541 ROM'.", "Quit");
83 return false;
84 }
85 fclose(file);
86 } else {
87 ShowRequester("Can't find '1541 ROM'.", "Quit");
88 return false;
89 }
90
91 return true;
92 }
93 #endif
94
95
96 #ifdef __BEOS__
97 #include "main_Be.i"
98 #endif
99
100 #ifdef AMIGA
101 #include "main_Amiga.i"
102 #endif
103
104 #ifdef __unix
105 #include "main_x.i"
106 #endif
107
108 #ifdef __mac__
109 #include "main_mac.i"
110 #endif
111
112 #ifdef WIN32
113 #include "main_WIN32.i"
114 #endif
115
116 #ifdef __riscos__
117 #include "main_Acorn.i"
118 #endif
119
120 #ifdef __PSXOS__
121 #include "main_PSX.i"
122 #endif
123