]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/jerry.cpp
Minor fixes, hopefully fix Exit hotkey on Win32.
[virtualjaguar] / src / jerry.cpp
index 2212cf285b8b4914567691817ba967e6ee3d9cdb..484fe01558d612194157ff90803ed8c240aaee40 100644 (file)
 #include "joystick.h"
 #include "log.h"
 #include "m68k.h"
+#include "tom.h"
 //#include "memory.h"
 #include "wavetable.h"
 
@@ -352,16 +353,24 @@ void JERRYResetPIT2(void)
 #endif
 }
 
+// This is the cause of the regressions in Cybermorph and Missile Command 3D...
+// Solution: Probably have to check the DSP enable bit before sending these thru.
+//#define JERRY_NO_IRQS
 void JERRYPIT1Callback(void)
 {
+#ifndef JERRY_NO_IRQS
 //WriteLog("JERRY: In PIT1 callback, IRQM=$%04X\n", jerryInterruptMask);
-       if (jerryInterruptMask & IRQ2_TIMER1)           // CPU Timer 1 IRQ
+       if (TOMIRQEnabled(IRQ_DSP))
        {
+               if (jerryInterruptMask & IRQ2_TIMER1)           // CPU Timer 1 IRQ
+               {
 // Not sure, but I think we don't generate another IRQ if one's already going...
 // But this seems to work... :-/
-               jerryPendingInterrupt |= IRQ2_TIMER1;
-               m68k_set_irq(2);                                                // Generate 68K IPL 2
+                       jerryPendingInterrupt |= IRQ2_TIMER1;
+                       m68k_set_irq(2);                                                // Generate 68K IPL 2
+               }
        }
+#endif
 
        DSPSetIRQLine(DSPIRQ_TIMER0, ASSERT_LINE);      // This does the 'IRQ enabled' checking...
        JERRYResetPIT1();
@@ -369,12 +378,17 @@ void JERRYPIT1Callback(void)
 
 void JERRYPIT2Callback(void)
 {
-//WriteLog("JERRY: In PIT2 callback, IRQM=$%04X\n", jerryInterruptMask);
-       if (jerryInterruptMask & IRQ2_TIMER2)           // CPU Timer 2 IRQ
+#ifndef JERRY_NO_IRQS
+       if (TOMIRQEnabled(IRQ_DSP))
        {
-               jerryPendingInterrupt |= IRQ2_TIMER2;
-               m68k_set_irq(2);                                                // Generate 68K IPL 2
+//WriteLog("JERRY: In PIT2 callback, IRQM=$%04X\n", jerryInterruptMask);
+               if (jerryInterruptMask & IRQ2_TIMER2)           // CPU Timer 2 IRQ
+               {
+                       jerryPendingInterrupt |= IRQ2_TIMER2;
+                       m68k_set_irq(2);                                                // Generate 68K IPL 2
+               }
        }
+#endif
 
        DSPSetIRQLine(DSPIRQ_TIMER1, ASSERT_LINE);      // This does the 'IRQ enabled' checking...
        JERRYResetPIT2();
@@ -441,13 +455,8 @@ void JERRYI2SCallback(void)
 
 void JERRYInit(void)
 {
-//     clock_init();
-//     anajoy_init();
        JoystickInit();
        DACInit();
-//This should be handled with the cart initialization...
-//     eeprom_init();
-//     memory_malloc_secure((void **)&jerry_ram_8, 0x10000, "JERRY RAM/ROM");
        memcpy(&jerry_ram_8[0xD000], waveTableROM, 0x1000);
 
        JERRYPIT1Prescaler = 0xFFFF;
@@ -460,8 +469,6 @@ void JERRYInit(void)
 
 void JERRYReset(void)
 {
-//     clock_reset();
-//     anajoy_reset();
        JoystickReset();
        EepromReset();
        JERRYResetI2S();
@@ -481,9 +488,6 @@ void JERRYReset(void)
 void JERRYDone(void)
 {
        WriteLog("JERRY: M68K Interrupt control ($F10020) = %04X\n", GET16(jerry_ram_8, 0x20));
-//     memory_free(jerry_ram_8);
-//     clock_done();
-//     anajoy_done();
        JoystickDone();
        DACDone();
        EepromDone();