ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/main.cpp
Revision: 1.2
Committed: 1999-10-21T22:39:53Z (24 years, 7 months ago) by cebix
Branch: MAIN
Changes since 1.1: +4 -0 lines
Log Message:
- ExtFS works under AmigaOS
- fixed erroneous __regargs attributes in prefs_editor_amiga.cpp
  and audio_amiga.cpp for GCC

File Contents

# Content
1 /*
2 * main.cpp - Startup/shutdown code
3 *
4 * Basilisk II (C) 1997-1999 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 "cpu_emulation.h"
24 #include "xpram.h"
25 #include "timer.h"
26 #include "sony.h"
27 #include "disk.h"
28 #include "cdrom.h"
29 #include "scsi.h"
30 #include "extfs.h"
31 #include "audio.h"
32 #include "video.h"
33 #include "serial.h"
34 #include "ether.h"
35 #include "clip.h"
36 #include "rom_patches.h"
37 #include "user_strings.h"
38 #include "prefs.h"
39 #include "main.h"
40
41 #define DEBUG 0
42 #include "debug.h"
43
44
45 /*
46 * Initialize everything, returns false on error
47 */
48
49 bool InitAll(void)
50 {
51 // Check ROM version
52 if (!CheckROM()) {
53 ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
54 return false;
55 }
56
57 #if EMULATED_68K
58 // Set CPU and FPU type (UAE emulation)
59 switch (ROMVersion) {
60 case ROM_VERSION_64K:
61 case ROM_VERSION_PLUS:
62 case ROM_VERSION_CLASSIC:
63 CPUType = 0;
64 FPUType = 0;
65 TwentyFourBitAddressing = true;
66 break;
67 case ROM_VERSION_II:
68 CPUType = 2;
69 FPUType = PrefsFindBool("fpu") ? 1 : 0;
70 TwentyFourBitAddressing = true;
71 break;
72 case ROM_VERSION_32:
73 CPUType = 3;
74 FPUType = PrefsFindBool("fpu") ? 1 : 0;
75 TwentyFourBitAddressing = false;
76 break;
77 }
78 CPUIs68060 = false;
79 #endif
80
81 // Load XPRAM
82 XPRAMInit();
83
84 // Set boot volume
85 int16 i16 = PrefsFindInt16("bootdrive");
86 XPRAM[0x78] = i16 >> 8;
87 XPRAM[0x79] = i16 & 0xff;
88 i16 = PrefsFindInt16("bootdriver");
89 XPRAM[0x7a] = i16 >> 8;
90 XPRAM[0x7b] = i16 & 0xff;
91
92 // Init drivers
93 SonyInit();
94 DiskInit();
95 CDROMInit();
96 SCSIInit();
97
98 #if SUPPORTS_EXTFS
99 // Init external file system
100 ExtFSInit();
101 #endif
102
103 // Init serial ports
104 SerialInit();
105
106 // Init network
107 EtherInit();
108
109 // Init Time Manager
110 TimerInit();
111
112 // Init clipboard
113 ClipInit();
114
115 // Init audio
116 AudioInit();
117
118 // Init video
119 if (!VideoInit(ROMVersion == ROM_VERSION_64K || ROMVersion == ROM_VERSION_PLUS || ROMVersion == ROM_VERSION_CLASSIC))
120 return false;
121
122 #if EMULATED_68K
123 // Init 680x0 emulation (this also activates the memory system which is needed for PatchROM())
124 if (!Init680x0())
125 return false;
126 #endif
127
128 // Install ROM patches
129 if (!PatchROM()) {
130 ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
131 return false;
132 }
133 return true;
134 }
135
136
137 /*
138 * Deinitialize everything
139 */
140
141 void ExitAll(void)
142 {
143 // Save XPRAM
144 XPRAMExit();
145
146 // Exit video
147 VideoExit();
148
149 // Exit audio
150 AudioExit();
151
152 // Exit clipboard
153 ClipExit();
154
155 // Exit Time Manager
156 TimerExit();
157
158 // Exit serial ports
159 SerialExit();
160
161 // Exit network
162 EtherExit();
163
164 #if SUPPORTS_EXTFS
165 // Exit external file system
166 ExtFSExit();
167 #endif
168
169 // Exit drivers
170 SCSIExit();
171 CDROMExit();
172 DiskExit();
173 SonyExit();
174 }