ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/BeOS/main_beos.cpp
(Generate patch)

Comparing BasiliskII/src/BeOS/main_beos.cpp (file contents):
Revision 1.1 by cebix, 1999-10-03T14:16:25Z vs.
Revision 1.8 by cebix, 2001-04-10T11:05:13Z

# Line 1 | Line 1
1   /*
2   *  main_beos.cpp - Startup code for BeOS
3   *
4 < *  Basilisk II (C) 1997-1999 Christian Bauer
4 > *  Basilisk II (C) 1997-2001 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
# Line 34 | Line 34
34   #include "cpu_emulation.h"
35   #include "xpram.h"
36   #include "timer.h"
37 #include "sony.h"
38 #include "disk.h"
39 #include "cdrom.h"
40 #include "scsi.h"
41 #include "audio.h"
37   #include "video.h"
43 #include "serial.h"
44 #include "ether.h"
45 #include "clip.h"
38   #include "rom_patches.h"
39   #include "prefs.h"
40   #include "prefs_editor.h"
# Line 184 | Line 176 | void BasiliskII::ReadyToRun(void)
176                  delete_area(old_rom_area);
177  
178          // Read preferences
179 <        PrefsInit();
179 >        int argc = 0;
180 >        char **argv = NULL;
181 >        PrefsInit(argc, argv);
182  
183          // Init system routines
184          SysInit();
# Line 222 | Line 216 | void BasiliskII::StartEmulator(void)
216          char str[256];
217  
218   #if REAL_ADDRESSING
219 <        // Open memory mess driver and remap low memory
219 >        // Open sheep driver and remap low memory
220          sheep_fd = open("/dev/sheep", 0);
221          if (sheep_fd < 0) {
222                  sprintf(str, GetString(STR_NO_SHEEP_DRIVER_ERR), strerror(sheep_fd), sheep_fd);
# Line 276 | Line 270 | void BasiliskII::StartEmulator(void)
270                  return;
271          }
272  
273 <        // Check ROM version
274 <        if (!CheckROM()) {
281 <                ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
282 <                PostMessage(B_QUIT_REQUESTED);
283 <                return;
284 <        }
285 <
286 <        // Set CPU and FPU type (UAE emulation)
287 <        switch (ROMVersion) {
288 <                case ROM_VERSION_64K:
289 <                case ROM_VERSION_PLUS:
290 <                case ROM_VERSION_CLASSIC:
291 <                        CPUType = 0;
292 <                        FPUType = 0;
293 <                        TwentyFourBitAddressing = true;
294 <                        break;
295 <                case ROM_VERSION_II:
296 <                        CPUType = 2;
297 <                        FPUType = PrefsFindBool("fpu") ? 1 : 0;
298 <                        TwentyFourBitAddressing = true;
299 <                        break;
300 <                case ROM_VERSION_32:
301 <                        CPUType = 3;
302 <                        FPUType = PrefsFindBool("fpu") ? 1 : 0;
303 <                        TwentyFourBitAddressing = false;
304 <                        break;
305 <        }
306 <        CPUIs68060 = false;
307 <
308 <        // Load XPRAM
309 <        XPRAMInit();
310 <
311 <        // Set boot volume
312 <        int16 i16 = PrefsFindInt16("bootdrive");
313 <        XPRAM[0x78] = i16 >> 8;
314 <        XPRAM[0x79] = i16 & 0xff;
315 <        i16 = PrefsFindInt16("bootdriver");
316 <        XPRAM[0x7a] = i16 >> 8;
317 <        XPRAM[0x7b] = i16 & 0xff;
318 <
319 <        // Start XPRAM watchdog thread
320 <        xpram_thread = spawn_thread(xpram_func, "XPRAM Watchdog", B_LOW_PRIORITY, this);
321 <        resume_thread(xpram_thread);
322 <
323 <        // Init drivers
324 <        SonyInit();
325 <        DiskInit();
326 <        CDROMInit();
327 <        SCSIInit();
328 <
329 <        // Init network
330 <        EtherInit();
331 <
332 <        // Init serial ports
333 <        SerialInit();
334 <
335 <        // Init Time Manager
336 <        TimerInit();
337 <
338 <        // Init clipboard
339 <        ClipInit();
340 <
341 <        // Init audio
342 <        AudioInit();
343 <
344 <        // Init video
345 <        if (!VideoInit(ROMVersion == ROM_VERSION_64K || ROMVersion == ROM_VERSION_PLUS || ROMVersion == ROM_VERSION_CLASSIC)) {
346 <                PostMessage(B_QUIT_REQUESTED);
347 <                return;
348 <        }
349 <
350 <        // Init 680x0 emulation (this also activates the memory system which is needed for PatchROM())
351 <        if (!Init680x0()) {
352 <                PostMessage(B_QUIT_REQUESTED);
353 <                return;
354 <        }
355 <
356 <        // Install ROM patches
357 <        if (!PatchROM()) {
358 <                ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR));
273 >        // Initialize everything
274 >        if (!InitAll()) {
275                  PostMessage(B_QUIT_REQUESTED);
276                  return;
277          }
# Line 366 | Line 282 | void BasiliskII::StartEmulator(void)
282          // Disallow quitting with Alt-Q from now on
283          AllowQuitting = false;
284  
285 +        // Start XPRAM watchdog thread
286 +        xpram_thread = spawn_thread(xpram_func, "XPRAM Watchdog", B_LOW_PRIORITY, this);
287 +        resume_thread(xpram_thread);
288 +
289          // Start 60Hz interrupt
290          tick_thread = spawn_thread(tick_func, "60Hz", B_REAL_TIME_PRIORITY, this);
291          resume_thread(tick_thread);
# Line 421 | Line 341 | void BasiliskII::Quit(void)
341                  wait_for_thread(xpram_thread, &l);
342          }
343  
344 <        // Save XPRAM
345 <        XPRAMExit();
426 <
427 <        // Exit video
428 <        VideoExit();
429 <
430 <        // Exit audio
431 <        AudioExit();
432 <
433 <        // Exit clipboard
434 <        ClipExit();
435 <
436 <        // Exit Time Manager
437 <        TimerExit();
438 <
439 <        // Exit serial ports
440 <        SerialExit();
441 <
442 <        // Exit network
443 <        EtherExit();
444 <
445 <        // Exit drivers
446 <        SCSIExit();
447 <        CDROMExit();
448 <        DiskExit();
449 <        SonyExit();
344 >        // Deinitialize everything
345 >        ExitAll();
346  
347          // Delete ROM area
348          if (rom_area >= 0)
# Line 609 | Line 505 | status_t BasiliskII::tick_func(void *arg
505                  if (++tick_counter > 60) {
506                          tick_counter = 0;
507                          WriteMacInt32(0x20c, TimerDateTime());
508 +                        SetInterruptFlag(INTFLAG_1HZ);
509 +                        TriggerInterrupt();
510                  }
511  
512                  // Trigger 60Hz interrupt

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines