]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/jaguar.cpp
Minor corrections to the file DB.
[virtualjaguar] / src / jaguar.cpp
index facaa12577ceedd4fef7af5f7b6e40552e688cbd..3ae824cbd7ad331fb61e83138e8acd51c78cf472 100644 (file)
@@ -5,7 +5,7 @@
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Carwin Jones (BeOS)
 // Cleanups and endian wrongness amelioration by James L. Hammons
 // Note: Endian wrongness probably stems from the MAME origins of this emu and
-//       the braindead way in which MAME handles memory. :-)
+//       the braindead way in which MAME handled memory when this was written. :-)
 //
 // JLH = James L. Hammons
 //
 #include "eeprom.h"
 #include "event.h"
 #include "gpu.h"
-#include "gui.h"
 #include "jerry.h"
 #include "joystick.h"
 #include "log.h"
 #include "m68k.h"
-#include "memory.h"
+//#include "memory.h"
 #include "mmu.h"
 #include "settings.h"
 #include "tom.h"
-#include "video.h"
 
 #define CPU_DEBUG
 //Do this in makefile??? Yes! Could, but it's easier to define here...
@@ -43,6 +41,7 @@
 #define ABORT_ON_ILLEGAL_INSTRUCTIONS
 //#define ABORT_ON_OFFICIAL_ILLEGAL_INSTRUCTION
 #define CPU_DEBUG_MEMORY
+//#define LOG_CD_BIOS_CALLS
 
 // Private function prototypes
 
@@ -60,26 +59,14 @@ extern int effect_start;
 extern int effect_start2, effect_start3, effect_start4, effect_start5, effect_start6;
 #endif
 
-// Memory debugging identifiers
-
-const char * whoName[9] =
-       { "Unknown", "Jaguar", "DSP", "GPU", "TOM", "JERRY", "M68K", "Blitter", "OP" };
-
 uint32 jaguar_active_memory_dumps = 0;
 
 uint32 jaguarMainROMCRC32, jaguarROMSize, jaguarRunAddress;
 
-uint8 jaguarMainRAM[0x400000];                                         // 68K CPU RAM
-uint8 jaguarMainROM[0x600000];                                         // 68K CPU ROM
-uint8 jaguarBootROM[0x040000];                                         // 68K CPU BIOS ROM--uses only half of this!
-uint8 jaguarCDBootROM[0x040000];                                       // 68K CPU CD BIOS ROM
 bool BIOSLoaded = false;
 bool CDBIOSLoaded = false;
 
-//uint8 cdRAM[0x100];
-uint8 * cdRAM = &jaguarMainROM[0x5FFF00];
-uint8 tomRAM[0x4000];
-uint8 jerryRAM[0x10000];
+uint32 * backbuffer;
 
 #ifdef CPU_DEBUG_MEMORY
 uint8 writeMemMax[0x400000], writeMemMin[0x400000];
@@ -257,6 +244,8 @@ if (m68kPC == 0x802058) start = true;
                WriteLog("--> [Calling BusWrite2] D2: %08X\n", m68k_get_reg(NULL, M68K_REG_D2));
 //             m68k_set_reg(M68K_REG_D2, 0x12345678);
        }//*/
+
+#ifdef LOG_CD_BIOS_CALLS
 /*
 CD_init::      -> $3000
 BIOS_VER::     -> $3004
@@ -322,7 +311,8 @@ CD_switch:: -> $306C
                WriteLog("\t\tA0=%08X, A1=%08X, D0=%08X, D1=%08X, D2=%08X\n",
                        m68k_get_reg(NULL, M68K_REG_A0), m68k_get_reg(NULL, M68K_REG_A1),
                        m68k_get_reg(NULL, M68K_REG_D0), m68k_get_reg(NULL, M68K_REG_D1), m68k_get_reg(NULL, M68K_REG_D2));
-//*/
+#endif
+
 #ifdef ABORT_ON_ILLEGAL_INSTRUCTIONS
        if (!m68k_is_valid_instruction(m68k_read_memory_16(m68kPC), M68K_CPU_TYPE_68000))
        {
@@ -805,7 +795,7 @@ int irq_ack_handler(int level)
        return vector;
 }
 
-#define USE_NEW_MMU
+//#define USE_NEW_MMU
 
 unsigned int m68k_read_memory_8(unsigned int address)
 {
@@ -1065,8 +1055,8 @@ if (address == 0xF02110)
                WriteLog("\tA0=%08X, A1=%08X, D0=%08X, D1=%08X\n",
                        m68k_get_reg(NULL, M68K_REG_A0), m68k_get_reg(NULL, M68K_REG_A1),
                        m68k_get_reg(NULL, M68K_REG_D0), m68k_get_reg(NULL, M68K_REG_D1));
-       }
 #endif
+       }
 #else
        MMUWrite16(address, value, M68K);
 #endif
@@ -1525,8 +1515,8 @@ void RenderCallback(void);
 //extern uint32 * backbuffer;
 void JaguarReset(void)
 {
-//NOTE: This causes a (virtual) crash if this is set in the config but not found... !!! FIX !!!
-       if (vjs.useJaguarBIOS)
+       // Only use the system BIOS if it's available...!
+       if (vjs.useJaguarBIOS && (biosAvailable & (BIOS_NORMAL | BIOS_STUB1 | BIOS_STUB2)))
                memcpy(jaguarMainRAM, jaguarBootROM, 8);
        else
                SET32(jaguarMainRAM, 4, jaguarRunAddress);
@@ -1905,7 +1895,8 @@ void ScanlineCallback(void)
 //     if (vc == vbb)
        {
                JoystickExec();
-               RenderBackbuffer();
+//We comment this out so that the GUI can manage this instead. Which is how it should be anyway.
+//             RenderBackbuffer();
                TOMResetBackbuffer(backbuffer);
                frameDone = true;
        }//*/
@@ -1922,7 +1913,7 @@ void ScanlineCallback(void)
 // This isn't currently used, but maybe it should be...
 void RenderCallback(void)
 {
-       RenderBackbuffer();
+//     RenderBackbuffer();
        TOMResetBackbuffer(backbuffer);
 //     SetCallbackTime(RenderCallback, 33303.082);     // # Scanlines * scanline time
        SetCallbackTime(RenderCallback, 16651.541);     // # Scanlines * scanline time