]> Shamusworld >> Repos - virtualjaguar/commitdiff
Initial fixes for audio subsystem. Fragile; may break in unexpected ways.
authorShamus Hammons <jlhamm@acm.org>
Fri, 27 Jan 2012 10:16:43 +0000 (10:16 +0000)
committerShamus Hammons <jlhamm@acm.org>
Fri, 27 Jan 2012 10:16:43 +0000 (10:16 +0000)
61 files changed:
Makefile
docs/INSTALL
docs/README
docs/TODO
docs/WHATSNEW
jaguarcore.mak
musashi.mak
src/blitter.cpp
src/cdintf.cpp
src/cdrom.cpp
src/crc32.cpp
src/dac.cpp
src/dac.h
src/dsp.cpp
src/eeprom.cpp
src/event.cpp
src/file.cpp
src/filedb.cpp
src/gpu.cpp
src/gui/about.cpp
src/gui/alpinetab.cpp
src/gui/app.cpp
src/gui/configdialog.cpp
src/gui/controllertab.cpp
src/gui/controllerwidget.cpp
src/gui/filelistmodel.cpp
src/gui/filepicker.cpp
src/gui/filethread.cpp
src/gui/generaltab.cpp
src/gui/glwidget.cpp
src/gui/imagedelegate.cpp
src/gui/keygrabber.cpp
src/gui/mainwin.cpp
src/jagbios.cpp
src/jagcdbios.cpp
src/jagdasm.cpp
src/jagdevcdbios.cpp
src/jagstub1bios.cpp
src/jagstub2bios.cpp
src/jaguar.cpp
src/jerry.cpp
src/jerry.h
src/joystick.cpp
src/log.cpp
src/m68000/Makefile
src/m68000/gencpu.c
src/m68000/m68kdasm.c
src/m68000/m68kinterface.c
src/m68000/table68k
src/memory.cpp
src/mmu.cpp
src/op.cpp
src/settings.cpp
src/state.cpp
src/tom.cpp
src/types.h
src/universalhdr.cpp
src/unzip.c
src/virtualjaguar.cpp
src/wavetable.cpp
virtualjaguar.pro

index 761360af08a7e04c7949bffe434c0b766de00ee0..03de51b29060be8e895b29bb94b3bb1f718f9ab0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,10 +26,10 @@ obj:
 
 prepare: obj
        @echo -e "\033[01;33m***\033[00;32m Preparing to compile Virtual Jaguar...\033[00m"
-#      @echo "#define VJ_RELEASE_VERSION \"v2.0.2\"" > src/version.h
+#      @echo "#define VJ_RELEASE_VERSION \"v2.0.3\"" > src/version.h
 #      @echo "#define VJ_RELEASE_SUBVERSION \"Final\"" >> src/version.h
        @echo "#define VJ_RELEASE_VERSION \"SVN `svn info | grep -i revision`\"" > src/version.h
-       @echo "#define VJ_RELEASE_SUBVERSION \"2.0.2 Prerelease\"" >> src/version.h
+       @echo "#define VJ_RELEASE_SUBVERSION \"2.0.3 Prerelease\"" >> src/version.h
 
 virtualjaguar: sources libs makefile-qt
        @echo -e "\033[01;33m***\033[00;32m Making Virtual Jaguar GUI...\033[00m"
index a5a7b5750137f1dbc3fa401adeb599bb7d670d40..fcb6f3aba0ae1653c14fd5d98235f1bcc4809b37 100644 (file)
@@ -1,5 +1,5 @@
 ----------------------------------------
-Virtual Jaguar v2.0.2 Qt release INSTALL
+Virtual Jaguar v2.0.3 Qt release INSTALL
 ----------------------------------------
 
 
index 9f75f917909acf14bd08fd40fbbb23543d878bfd..aed97e1b1ca92c9206feef625773a5016385cae9 100644 (file)
@@ -1,5 +1,5 @@
 -------------------------------------------
-Virtual Jaguar v2.0.2 GCC/Qt release README
+Virtual Jaguar v2.0.3 GCC/Qt release README
 -------------------------------------------
 
 --------------
@@ -93,7 +93,7 @@ systems as well but we can not guarantee that.
 
 The port was done by the SDLEMU crew (http://sdlemu.ngemu.com) and especially
 by Niels Wagenaar and Carwin Jones. A major portion of the rewrite was done by
-James L. Hammons. You may contact us by e-mail (sdlemu@ngemu.com) or leave a
+James Hammons. You may contact us by e-mail (sdlemu@ngemu.com) or leave a
 message on the SDLEMU Official Forum (see the website). Patches and bugfixes
 are particularly welcome! :)
 
index ed4b68b1ca12b8859a295ea670305afb3ecc042b..f8276aff5a9e3015db35be95ca90e82897659deb 100644 (file)
--- a/docs/TODO
+++ b/docs/TODO
@@ -1,6 +1,8 @@
 Stuff to add/fix for the next release of Virtual Jaguar
 -------------------------------------------------------
 
+- Fix VC behavior to match what a real Jaguar does. Still not sure just what
+  the heck is going on there. [Shamus]
 - Fix DSP code so that it doesn't hang in a spinlock waiting for the sound
   buffer to empty. Probably a CS lock contention issue. [Shamus]
 - Create an EEPROMs directory (or whatever is in EEPROMPath[]) if it doesn't
index 7019f5573abf1760086e1aea3ecc9b190abd2677..3cfcd9aada8b6d53c187c1991ed11b9b5e49e59f 100644 (file)
@@ -1,3 +1,12 @@
+Virtual Jaguar v2.0.3 GCC/Qt
+----------------------------
+
+* Kludged a fix into the audio handler to set the correct frequency for audio
+  playback. Note that there could still be problems with this approach, as it
+  can be easily fooled. Thanks to Dr. Typo for the initial analysis and insight
+  into this bug. :-) [Shamus]
+
+
 Virtual Jaguar v2.0.2 GCC/Qt
 ----------------------------
 
@@ -8,7 +17,7 @@ Virtual Jaguar v2.0.2 GCC/Qt
   real hardware. [Shamus]
 * Fixed video frame timing for both NTSC *and* PAL. [Shamus]
 * Improved OP logging, added emulation of OP bug. [Shamus]
-* Fixed VC behavior to match what a real Jaguar does. [Shamus]
+* Fixed addressing bug with UAE 68000 core. [Shamus]
 
 
 Virtual Jaguar v2.0.1 GCC/Qt
index 7d0ef6f68281d30ea5c39f7172606544612978b1..16e0b1edaa8baf9494017db42095f30faae5966f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Makefile for Virtual Jaguar core library
 #
-# by James L. Hammons
+# by James Hammons
 #
 # This software is licensed under the GPL v3 or any later version. See the
 # file GPLv3 for details. ;-)
index 869b19b92b52e113f78fed91b8e2c414c6f72e3c..9aa460b666c486442d0e46a912fbbeb7db574ce7 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Makefile for Musashi Portable 68000 Emulator
 #
-# by James L. Hammons
+# by James Hammons
 #
 # This makefile is licensed under the GPL v3 or any later version. See the
 # file GPLv3 for details. ;-)
index 3db442f3824dabd51d8034694d9ac3fc11ba82fd..4e8ea746388e7bc095609a2d0b75a170fbd0cc52 100644 (file)
@@ -1,10 +1,10 @@
 //
 // Blitter core
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 8973c4543068b5fec64bd148afb890848a734c3d..1f0993b482ccbc32dcf5416ac9a8a1b950812963 100644 (file)
@@ -1,10 +1,10 @@
 //
 // OS agnostic CDROM interface functions
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index c45a8f0306c06c5970a8a52bbd98e4b1daa4e45e..3f419816b5272346abc57622d4ccd532b31db5b1 100644 (file)
@@ -3,10 +3,10 @@
 //
 // Originally by David Raingeard
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Extensive rewrites/cleanups/fixes by James L. Hammons
+// Extensive rewrites/cleanups/fixes by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 8cb637bc70bb5ea71c6cdc344d67416eb3f19c80..1886971ef79b49a8b6526390846314effebc6b96 100644 (file)
@@ -3,10 +3,10 @@
 //
 // by David Raingeard
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Cleanups by James L. Hammons
+// Cleanups by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index dbb1b5842caeef2469dce21d0c46589391a4f259..617918a13f725f248f9403a5bf6741706a77e4a8 100644 (file)
@@ -3,10 +3,10 @@
 //
 // Originally by David Raingeard
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Rewritten by James L. Hammons
+// Rewritten by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -69,7 +69,6 @@ static uint8 SCLKFrequencyDivider = 19;                               // Default is roughly 22 KHz (20774 H
 // Private function prototypes
 
 void SDLSoundCallback(void * userdata, Uint8 * buffer, int length);
-int GetCalculatedFrequency(void);
 
 //
 // Initialize the SDL sound system
@@ -201,6 +200,44 @@ int GetCalculatedFrequency(void)
        return systemClockFrequency / (32 * (2 * (SCLKFrequencyDivider + 1)));
 }
 
+static int oldFreq = 0;
+
+void DACSetNewFrequency(int freq)
+{
+       if (freq == oldFreq)
+               return;
+
+       oldFreq = freq;
+
+       // Should do some sanity checking on the frequency...
+
+       if (SDLSoundInitialized)
+               SDL_CloseAudio();
+
+       desired.freq = freq;// SDL will do conversion on the fly, if it can't get the exact rate. Nice!
+       WriteLog("DAC: Changing sample rate to %u Hz!\n", desired.freq);
+
+       if (SDLSoundInitialized)
+       {
+               if (SDL_OpenAudio(&desired, NULL) < 0)  // NULL means SDL guarantees what we want
+               {
+// This is bad, Bad, BAD !!! DON'T ABORT BECAUSE WE DIDN'T GET OUR FREQ! !!! FIX !!!
+#warning !!! FIX !!! Aborting because of SDL audio problem is bad!
+                       WriteLog("DAC: Failed to initialize SDL sound: %s.\nDesired freq: %u\nShutting down!\n", SDL_GetError(), desired.freq);
+//                                             LogDone();
+//                                             exit(1);
+#warning "Reimplement GUICrashGracefully!"
+//                                             GUICrashGracefully("Failed to initialize SDL sound!");
+                       return;
+               }
+       }
+
+       DACReset();
+
+       if (SDLSoundInitialized)
+               SDL_PauseAudio(false);                  // Start playback!
+}
+
 //
 // LTXD/RTXD/SCLK/SMODE ($F1A148/4C/50/54)
 //
index ac94d06fffef6a4d163b8f1b07b610fcdd3b0ae6..023855f014c3bcfc4619784d142ed5d64fed5717 100644 (file)
--- a/src/dac.h
+++ b/src/dac.h
@@ -11,6 +11,8 @@
 void DACInit(void);
 void DACReset(void);
 void DACDone(void);
+int GetCalculatedFrequency(void);
+void DACSetNewFrequency(int);
 
 // DAC memory access
 
index 168ea3ac29c80cbf9e9526e97b16737a08976da9..74839cc4b7eee9b6708d02c8e56a5573ca724ad2 100644 (file)
@@ -3,10 +3,10 @@
 //
 // Originally by David Raingeard
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Extensive cleanups/rewrites by James L. Hammons
+// Extensive cleanups/rewrites by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -18,6 +18,7 @@
 
 #include <SDL.h>                                                               // Used only for SDL_GetTicks...
 #include <stdlib.h>
+#include "dac.h"
 #include "gpu.h"
 #include "jagdasm.h"
 #include "jaguar.h"
@@ -796,6 +797,28 @@ SET32(ram2, offset, data);
                        DSPUpdateRegisterBanks();
                        dsp_control &= ~((dsp_flags & CINT04FLAGS) >> 3);
                        dsp_control &= ~((dsp_flags & CINT5FLAG) >> 1);
+
+// NB: This is just a wild hairy-assed guess as to what the playback frequency is.
+//     It can be timed to anything really, anything that writes to L/RTXD at a regular
+//     interval. Most things seem to use either the I2S interrupt or the TIMER 0
+//     interrupt, so that's what we check for here. Just know that this approach
+//     can be easily fooled!
+//     Note also that if both interrupts are enabled, the I2S freq will win. :-P
+                       if (data & INT_ENA1) // I2S interrupt
+                       {
+                               int freq = GetCalculatedFrequency();
+//This happens too often to be useful...
+//                             WriteLog("DSP: Setting audio freqency to %u Hz...\n", freq);
+                               DACSetNewFrequency(freq);
+                       }
+                       else if (data & INT_ENA2) // TIMER 0 interrupt
+                       {
+                               int freq = JERRYGetPIT1Frequency();
+//This happens too often to be useful...
+//                             WriteLog("DSP: Setting audio freqency to %u Hz...\n", freq);
+                               DACSetNewFrequency(freq);
+                       }
+
 /*                     if (IMASKCleared)                                               // If IMASK was cleared,
 #ifdef DSP_DEBUG_IRQ
                        {
@@ -1333,7 +1356,10 @@ void DSPDone(void)
        // get the interrupt mask
        int mask = ((dsp_flags >> 11) & 0x20) | ((dsp_flags >> 4) & 0x1F);
 
-       WriteLog("DSP: pending=%08X enabled=%08X\n", bits, mask);
+       WriteLog("DSP: pending=$%X enabled=$%X (%s%s%s%s%s%s)\n", bits, mask,
+               (mask & 0x01 ? "CPU " : ""), (mask & 0x02 ? "I2S " : ""),
+               (mask & 0x04 ? "Timer0 " : ""), (mask & 0x08 ? "Timer1 " : ""),
+               (mask & 0x10 ? "Ext0 " : ""), (mask & 0x20 ? "Ext1" : ""));
        WriteLog("\nRegisters bank 0\n");
        for(int j=0; j<8; j++)
        {
index 4b8dda8981ef31e0b77d68c64b2993a5d059f1ed..bba94afd3d4cb5f283b79cc30a08aaa53d04a5c0 100644 (file)
@@ -3,10 +3,10 @@
 //
 // by Cal2
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Cleanups/enhancements by James L. Hammons
+// Cleanups/enhancements by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index e0daebb78559725d5f8dff3e85859ac352ea5a41..b455cd60bf47498d123699fe3c677826f118ff0d 100644 (file)
@@ -1,10 +1,10 @@
 //
 // System time handlers
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 71f33e7199ad6bd2b59088c2d3880990ddfba6e5..acf90d6f64bff6b61e106258b288b959d9822039 100644 (file)
@@ -2,10 +2,10 @@
 // FILE.CPP
 //
 // File support
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index eadfda72f7cd5641da81fe13d4f4b5a4ad95ee04..d9105839d08d146b8c41e7fbeea374710f8355a0 100644 (file)
@@ -1,10 +1,10 @@
 //
 // filedb.cpp - File database
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 93a32d9a826780bc074e109166c941a7519f5172..2ea973d864a0a30ef24175a355352740dc765634 100644 (file)
@@ -5,10 +5,10 @@
 //
 // Originally by David Raingeard (Cal2)
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Cleanups, endian wrongness, and bad ASM amelioration by James L. Hammons
+// Cleanups, endian wrongness, and bad ASM amelioration by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 1e11561479f8a686703283f83682b8b2341cd49c..5cf1ade6d9d49f25fc01e70eafad89a22741d522 100644 (file)
@@ -1,10 +1,10 @@
 //
 // about.cpp - Credits
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -39,8 +39,8 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
                "<tr><td align='right'><b>Version: </b></td><td>"
                VJ_RELEASE_VERSION " (" VJ_RELEASE_SUBVERSION ")"
                "</td></tr>"
-               "<tr><td align='right'><b>Coders: </b></td><td>James L. Hammons (shamus)<br>Niels Wagenaar (nwagenaar)<br>Carwin Jones (Caz)<br>Adam Green</td></tr>"
-               "<tr><td align='right'><b>Testers: </b></td><td>Cyrano Jones, Robert R, TheUMan, Dissection,<br>overridex, geormetal</td></tr>"
+               "<tr><td align='right'><b>Coders: </b></td><td>James Hammons (shamus)<br>Niels Wagenaar (nwagenaar)<br>Carwin Jones (Caz)<br>Adam Green</td></tr>"
+               "<tr><td align='right'><b>Testers: </b></td><td>Cyrano Jones, LinkoVitch, neo-rg, Robert R,<br>TheUMan, Dissection, overridex, geormetal</td></tr>"
                "<tr><td align='right'><b>Build Team: </b></td><td>ggn (win32)<br>LinkoVitch, goldenegg (MacOS)</td></tr>"
                "<tr><td align='right'><b>Homepage: </b></td><td>http://icculus.org/virtualjaguar/</td></tr>"
                "</table>"
index 7701687ba03e55ada360cf668d9b47ce7f73dd78..d3e35f67709a5e8dacf4d2c56b9721f1cc053e49 100644 (file)
@@ -5,7 +5,7 @@
 // (C) 2011 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
index aad90feb2b128db4e6982916d2356868f7ea6f01..7c2037f3a81273eb34e9ec6ddce8ac4cde59fc03 100644 (file)
@@ -1,10 +1,10 @@
 //
 // app.cpp - Qt-based GUI for Virtual Jaguar
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -40,8 +40,8 @@ int main(int argc, char * argv[])
                {
                        printf("Virtual Jaguar 2.0.0 help\n");
                        printf("\n");
-                       printf("Command line interface is non-functional ATM, but may return if there is\n"
-                               "enough demand for it. :-)\n");
+                       printf("Command line interface is mostly non-functional ATM, but may return if\n"
+                               "there is enough demand for it. :-)\n");
                        return 0;
                }
                if (strcmp(argv[1], "--yarrr") == 0)
@@ -63,9 +63,12 @@ int main(int argc, char * argv[])
        // This is so we can pass this stuff using signal/slot mechanism...
 //ick  int id = qRegisterMetaType<uint32>();
 
-       LogInit("virtualjaguar.log");                           // Init logfile
+       bool success = (bool)LogInit("virtualjaguar.log");      // Init logfile
        int retVal = -1;                                                        // Default is failure
 
+       if (!success)
+               printf("Failed to open virtualjaguar.log for writing!\n");
+
        // Set up SDL library
        if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0)
        {
index f75fbf1ce115744b0282c7fa5b03439663465aad..709940c3f4a63efafbefec3743b74923e394e78e 100644 (file)
@@ -1,10 +1,10 @@
 //
 // configdialog.cpp - Configuration dialog
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 34ca1558541b30ab1e73709bc150d437eac00c4c..957e568b1d7a32144ae219ce19fbc5283ed6c3d0 100644 (file)
@@ -5,7 +5,7 @@
 // (C) 2011 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
index fd9ebf24bee74952235e38e458c5a15c0054a407..bbdafa2c9960452bbcf9cfe58bdd9e271d0636cc 100644 (file)
@@ -5,7 +5,7 @@
 // (C) 2011 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
index 00bb0bbed8fcd48ee830882257ba33c2b5612f85..36b32b557831653467c1a9450346e97956cb317d 100644 (file)
@@ -1,10 +1,10 @@
 //
 // filelistmodel.cpp - A ROM chooser
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 2082ee92fe5a7ca49f8aa4177ee1f54e47bb7fe8..67eb5fd75804f4737613ad3c91b570706cd3c5c8 100644 (file)
@@ -1,10 +1,10 @@
 //
 // filepicker.cpp - A ROM chooser
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -86,26 +86,26 @@ printf("VSB size: %u, %u\n", sbSize3.width(), sbSize3.height());
        // This sets it to the "too large size" as the minimum!
        QScrollBar * vsb = new QScrollBar(Qt::Vertical, this);
        int sbWidth = vsb->size().width();
-       printf("VSB size width: %u\n", sbWidth);
+//     printf("VSB size width: %u\n", sbWidth);
        int sbWidth2 = vsb->sizeHint().width();
-       printf("VSB sizeHint width: %u\n", sbWidth2);
+//     printf("VSB sizeHint width: %u\n", sbWidth2);
        int sbWidth3 = vsb->minimumSize().width();
-       printf("VSB minimum width: %u\n", sbWidth3);
+//     printf("VSB minimum width: %u\n", sbWidth3);
        int sbWidth4 = vsb->frameSize().width();
-       printf("VSB frame width: %u\n", sbWidth4);
+//     printf("VSB frame width: %u\n", sbWidth4);
        delete vsb;
 
 //     fileList->setFixedWidth((488/4) + 4);
        int sbWidth5 = fileList->frameWidth();
-       printf("List frame width: %u, (diff=%d)\n", sbWidth5, sbWidth5 - ((488/4) + 4));
+//     printf("List frame width: %u, (diff=%d)\n", sbWidth5, sbWidth5 - ((488/4) + 4));
        int sbWidth6 = fileList->sizeHint().width();
-       printf("List sizeHint width: %u\n", sbWidth6);
+//     printf("List sizeHint width: %u\n", sbWidth6);
        int sbWidth7 = fileList->minimumSize().width();
-       printf("List minimum width: %u\n", sbWidth7);
+//     printf("List minimum width: %u\n", sbWidth7);
        int sbWidth8 = fileList->minimumSizeHint().width();
-       printf("List minimum hint width: %u\n", sbWidth8);
-//     fileList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
-//     fileList->verticalScrollBar()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+//     printf("List minimum hint width: %u\n", sbWidth8);
+////   fileList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+////   fileList->verticalScrollBar()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
        // (488/4) + 4 is the width of the object in the filelistmodel. Dunno why the QListView
        // isn't picking that up. :-(
        // 488/4 + 4 = 126
index 03519085e9111f436a234b62cee11c528d940c99..bde97eddab985324e251aef1ffdca97477580fa9 100644 (file)
@@ -1,10 +1,10 @@
 //
 // filethread.cpp - File discovery thread
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 883f13755397f4e3998670e143c1974cd0fa3ec8..c71b1c30048f125fe1e3c38bfe4509d5b8526e32 100644 (file)
@@ -5,7 +5,7 @@
 // (C) 2011 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
index e09ebd2fac1c065ae84223371e613d6f9d4c0816..747370791df7084fbe09f23e51f5eb76f42897c6 100644 (file)
@@ -1,10 +1,10 @@
 // OpenGL implementation in Qt
 // Parts of this are blantantly ripped off from BSNES (thanks Byuu!)
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index e7ab7111b28bb45adb50364dd53751f5917f6953..06fb43e96c54bdbac811ef28fef08c2890749506 100644 (file)
@@ -1,10 +1,10 @@
 //
 // imagedelegate.cpp - Qt Model/View rendering class
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 23954b855450c65fa765e984c022ddb8130c61c4..694be3cb5d20439e78edc2c7e5536d544b9d2998 100644 (file)
@@ -1,10 +1,10 @@
 //
 // keygrabber.cpp - Widget to grab a key and dismiss itself
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2011 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index af1dab100837dae93376b6338a0c671ccb288e2a..56299f3a5d13d58a25459a5d7bc7a22542b663b2 100644 (file)
@@ -1,9 +1,9 @@
 //
 // mainwin.cpp - Qt-based GUI for Virtual Jaguar: Main Application Window
-// by James L. Hammons
+// by James Hammons
 // (C) 2009 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -592,7 +592,10 @@ void MainWin::Unpause(void)
        if (pauseForFileSelector)
        {
                pauseForFileSelector = false;
-               ToggleRunState();
+
+               // Some nutter might have unpaused while in the file selector, so check for that
+               if (!running)
+                       ToggleRunState();
        }
 }
 
index 7d9706d2ae921a13057c96b28602c02f92227a39..363334675c271132412e4c9025663726c73b0260 100644 (file)
@@ -1,5 +1,5 @@
 //
-// This file was automagically generated by bin2c (by James L. Hammons)
+// This file was automagically generated by bin2c (by James Hammons)
 //
 
 char jaguarBootROM[0x20000] = {
index e6c55a8aaf2eebcf90585e1f45b85e21f4416fdd..eea4cf0c1ca379476155de60baae586a0f37cf68 100644 (file)
@@ -1,5 +1,5 @@
 //
-// This file was automagically generated by bin2c (by James L. Hammons)
+// This file was automagically generated by bin2c (by James Hammons)
 //
 
 char jaguarCDBootROM[0x40000] = {
index 6fadae8a03694f755b2f81cea40718e202254f70..5f18f110a582fcb276a58b46a6909fa18f56a557 100644 (file)
@@ -61,8 +61,9 @@ char * signed_16bit(int16 val)
        return temp;
 }
 
-unsigned dasmjag(int dsp_type, char * buffer, unsigned pc)
+unsigned dasmjag(int dsp_type, char * bufferOut, unsigned pc)
 {
+       char buffer[64];
        int op = ROPCODE(pc);
        int reg1 = (op >> 5) & 31;
        int reg2 = op & 31;
@@ -160,7 +161,7 @@ unsigned dasmjag(int dsp_type, char * buffer, unsigned pc)
                                                sprintf(buffer, "ADDQMOD $%X,R%02d", convert_zero[reg1], reg2);
                                        break;
        }
-       sprintf(buffer,"%-24s (%04X)", buffer, op);
+       sprintf(bufferOut,"%-24s (%04X)", buffer, op);
 
        return size;
 }
index 389fc9ff9a81128f4cd2d3b641eb87faeb9d58c9..85dbe91de883eaa7faf681b5063f66de18b8e212 100644 (file)
@@ -1,5 +1,5 @@
 //
-// This file was automagically generated by bin2c (by James L. Hammons)
+// This file was automagically generated by bin2c (by James Hammons)
 //
 
 char jaguarDevCDBootROM[0x40000] = {
index 83de7b4d2f145872602877940b6d2a3e9a78a757..80fdd43fc12becd18c54e772cb8a91e21e6b662a 100644 (file)
@@ -1,5 +1,5 @@
 //
-// This file was automagically generated by bin2c (by James L. Hammons)
+// This file was automagically generated by bin2c (by James Hammons)
 //
 
 char jaguarDevBootROM1[0x20000] = {
index 500675f5882138058c5c5dfa644fee16f9c3f528..884680af7fa10a0367ce66ad315760d6c5449475 100644 (file)
@@ -1,5 +1,5 @@
 //
-// This file was automagically generated by bin2c (by James L. Hammons)
+// This file was automagically generated by bin2c (by James Hammons)
 //
 
 char jaguarDevBootROM2[0x20000] = {
index f45678710f6cb853d0e6fa5729c21b962c861e17..b6c9f194ce4d80410e5732882db70d2ba53a6a6c 100644 (file)
@@ -3,11 +3,11 @@
 //
 // Originally by David Raingeard (Cal2)
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Carwin Jones (BeOS)
-// Cleanups and endian wrongness amelioration by James L. Hammons
+// Cleanups and endian wrongness amelioration by James Hammons
 // Note: Endian wrongness probably stems from the MAME origins of this emu and
 //       the braindead way in which MAME handled memory when this was written. :-)
 //
-// JLH = James L. Hammons
+// JLH = James Hammons
 //
 // WHO  WHEN        WHAT
 // ---  ----------  -----------------------------------------------------------
@@ -818,6 +818,39 @@ uint32 ReadDWord(uint32 adddress)
 }
 #endif
 
+void ShowM68KContext(void)
+{
+       printf("\t68K PC=%06X\n", m68k_get_reg(NULL, M68K_REG_PC));
+
+       for(int i=M68K_REG_D0; i<=M68K_REG_D7; i++)
+       {
+               printf("D%i = %08X ", i-M68K_REG_D0, m68k_get_reg(NULL, (m68k_register_t)i));
+
+               if (i == M68K_REG_D3 || i == M68K_REG_D7)
+                       printf("\n");
+       }
+
+       for(int i=M68K_REG_A0; i<=M68K_REG_A7; i++)
+       {
+               printf("A%i = %08X ", i-M68K_REG_A0, m68k_get_reg(NULL, (m68k_register_t)i));
+
+               if (i == M68K_REG_A3 || i == M68K_REG_A7)
+                       printf("\n");
+       }
+
+       uint32_t currpc = m68k_get_reg(NULL, M68K_REG_PC);
+       uint32_t disPC = currpc - 30;
+       char buffer[128];
+
+       do
+       {
+               uint32_t oldpc = disPC;
+               disPC += m68k_disassemble(buffer, disPC, 0);
+               printf("%s%08X: %s\n", (oldpc == currpc ? ">" : " "), oldpc, buffer);
+       }
+       while (disPC < (currpc + 10));
+}
+
 //
 // Musashi 68000 read/write/IRQ functions
 //
@@ -906,6 +939,8 @@ int irq_ack_handler(int level)
 
 unsigned int m68k_read_memory_8(unsigned int address)
 {
+       // Musashi does this automagically for you, UAE core does not :-P
+       address &= 0x00FFFFFF;
 #ifdef CPU_DEBUG_MEMORY
        if ((address >= 0x000000) && (address <= 0x3FFFFF))
        {
@@ -954,6 +989,8 @@ void gpu_dump_registers(void);
 
 unsigned int m68k_read_memory_16(unsigned int address)
 {
+       // Musashi does this automagically for you, UAE core does not :-P
+       address &= 0x00FFFFFF;
 #ifdef CPU_DEBUG_MEMORY
 /*     if ((address >= 0x000000) && (address <= 0x3FFFFE))
        {
@@ -1052,6 +1089,8 @@ unsigned int m68k_read_memory_16(unsigned int address)
 
 unsigned int m68k_read_memory_32(unsigned int address)
 {
+       // Musashi does this automagically for you, UAE core does not :-P
+       address &= 0x00FFFFFF;
 //; So, it seems that it stores the returned DWORD at $51136 and $FB074.
 /*     if (address == 0x51136 || address == 0xFB074 || address == 0x1AF05E)
                WriteLog("[RM32  PC=%08X] Addr: %08X, val: %08X\n", m68k_get_reg(NULL, M68K_REG_PC), address, (m68k_read_memory_16(address) << 16) | m68k_read_memory_16(address + 2));//*/
@@ -1066,6 +1105,8 @@ unsigned int m68k_read_memory_32(unsigned int address)
 
 void m68k_write_memory_8(unsigned int address, unsigned int value)
 {
+       // Musashi does this automagically for you, UAE core does not :-P
+       address &= 0x00FFFFFF;
 #ifdef CPU_DEBUG_MEMORY
        if ((address >= 0x000000) && (address <= 0x3FFFFF))
        {
@@ -1089,6 +1130,10 @@ void m68k_write_memory_8(unsigned int address, unsigned int value)
 //$53D0
 /*if (address >= 0x53D0 && address <= 0x53FF)
        printf("M68K: Writing byte $%02X at $%08X, PC=$%08X\n", value, address, m68k_get_reg(NULL, M68K_REG_PC));//*/
+//Testing AvP on UAE core...
+//000075A0: FFFFF80E B6320220 (BITMAP)
+/*if (address == 0x75A0 && value == 0xFF)
+       printf("M68K: (8) Tripwire hit...\n");//*/
 
 #ifndef USE_NEW_MMU
        if ((address >= 0x000000) && (address <= 0x3FFFFF))
@@ -1108,6 +1153,8 @@ void m68k_write_memory_8(unsigned int address, unsigned int value)
 
 void m68k_write_memory_16(unsigned int address, unsigned int value)
 {
+       // Musashi does this automagically for you, UAE core does not :-P
+       address &= 0x00FFFFFF;
 #ifdef CPU_DEBUG_MEMORY
        if ((address >= 0x000000) && (address <= 0x3FFFFE))
        {
@@ -1155,6 +1202,13 @@ if (address == 0xF02110)
 //$53D0
 /*if (address >= 0x53D0 && address <= 0x53FF)
        printf("M68K: Writing word $%04X at $%08X, PC=$%08X\n", value, address, m68k_get_reg(NULL, M68K_REG_PC));//*/
+//Testing AvP on UAE core...
+//000075A0: FFFFF80E B6320220 (BITMAP)
+/*if (address == 0x75A0 && value == 0xFFFF)
+{
+       printf("\nM68K: (16) Tripwire hit...\n");
+       ShowM68KContext();
+}//*/
 
 #ifndef USE_NEW_MMU
        if ((address >= 0x000000) && (address <= 0x3FFFFE))
@@ -1185,6 +1239,8 @@ if (address == 0xF02110)
 
 void m68k_write_memory_32(unsigned int address, unsigned int value)
 {
+       // Musashi does this automagically for you, UAE core does not :-P
+       address &= 0x00FFFFFF;
 /*if (address == 0x4E00)
        WriteLog("M68K: Writing %02X at %08X, PC=%08X\n", value, address, m68k_get_reg(NULL, M68K_REG_PC));//*/
 //WriteLog("--> [WM32]\n");
@@ -1199,6 +1255,13 @@ if (address == 0xF03214 && value == 0x88E30047)
        doGPUDis = true;//*/
 /*     if (address == 0x51136 || address == 0xFB074)
                WriteLog("[WM32  PC=%08X] Addr: %08X, val: %02X\n", m68k_get_reg(NULL, M68K_REG_PC), address, value);//*/
+//Testing AvP on UAE core...
+//000075A0: FFFFF80E B6320220 (BITMAP)
+/*if (address == 0x75A0 && (value & 0xFFFF0000) == 0xFFFF0000)
+{
+       printf("\nM68K: (32) Tripwire hit...\n");
+       ShowM68KContext();
+}//*/
 
 #ifndef USE_NEW_MMU
        m68k_write_memory_16(address, value >> 16);
@@ -1222,12 +1285,23 @@ bool JaguarInterruptHandlerIsValid(uint32 i) // Debug use only...
 
 void M68K_show_context(void)
 {
-       WriteLog("\t68K PC=%06X\n", m68k_get_reg(NULL, M68K_REG_PC));
+       WriteLog("68K PC=%06X\n", m68k_get_reg(NULL, M68K_REG_PC));
+
        for(int i=M68K_REG_D0; i<=M68K_REG_D7; i++)
-               WriteLog("\tD%i = %08X\n", i-M68K_REG_D0, m68k_get_reg(NULL, (m68k_register_t)i));
-       WriteLog("\n");
+       {
+               WriteLog("D%i = %08X ", i-M68K_REG_D0, m68k_get_reg(NULL, (m68k_register_t)i));
+
+               if (i == M68K_REG_D3 || i == M68K_REG_D7)
+                       WriteLog("\n");
+       }
+
        for(int i=M68K_REG_A0; i<=M68K_REG_A7; i++)
-               WriteLog("\tA%i = %08X\n", i-M68K_REG_A0, m68k_get_reg(NULL, (m68k_register_t)i));
+       {
+               WriteLog("A%i = %08X ", i-M68K_REG_A0, m68k_get_reg(NULL, (m68k_register_t)i));
+
+               if (i == M68K_REG_A3 || i == M68K_REG_A7)
+                       WriteLog("\n");
+       }
 
        WriteLog("68K disasm\n");
 //     jaguar_dasm(s68000readPC()-0x1000,0x20000);
@@ -1651,9 +1725,10 @@ void JaguarInit(void)
 //Seems to want $01010101... Dunno why. Investigate!
        memset(jaguarMainROM, 0x01, 0x600000);  // & set it to all 01s...
 //     memset(jaguar_mainRom, 0xFF, 0x600000); // & set it to all Fs...
-       lowerField = false;                                                             // Reset the lower field flag
+       lowerField = false;                                                     // Reset the lower field flag
 
        m68k_set_cpu_type(M68K_CPU_TYPE_68000);
+       m68k_pulse_reset();                                                     // Need to do this so UAE disasm doesn't segfault on exit
        GPUInit();
        DSPInit();
        TOMInit();
@@ -1819,6 +1894,12 @@ void JaguarDone(void)
 /*     WriteLog("\n\nM68000 disassembly at $4000...\n");
        JaguarDasm(0x4000, 10000);
        WriteLog("\n");//*/
+//     WriteLog("\n\nM68000 disassembly at $802000...\n");
+//     JaguarDasm(0x800830, 0x1000);
+//     WriteLog("\n\nM68000 disassembly at $4100...\n");
+//     JaguarDasm(0x4100, 200);
+//     WriteLog("\n\nM68000 disassembly at $800800...\n");
+//     JaguarDasm(0x800800, 0x1000);
 }
 
 //
index 484fe01558d612194157ff90803ed8c240aaee40..cba9571c808a666326dc71e58dab7e7a383767ed 100644 (file)
@@ -3,9 +3,9 @@
 //
 // Originally by David Raingeard
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Carwin Jones (BeOS)
-// Cleanups/rewrites/fixes by James L. Hammons
+// Cleanups/rewrites/fixes by James Hammons
 //
-// JLH = James L. Hammons
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  -----------------------------------------------------------
 #include "joystick.h"
 #include "log.h"
 #include "m68k.h"
+#include "settings.h"
 #include "tom.h"
 //#include "memory.h"
 #include "wavetable.h"
@@ -809,6 +810,10 @@ else if (offset == 0xF10012)
        WriteLog("JERRY: CLK2 word written by %s: %u\n", whoName[who], data);
 else if (offset == 0xF10014)
        WriteLog("JERRY: CLK3 word written by %s: %u\n", whoName[who], data);
+//else if (offset == 0xF1A100)
+//     WriteLog("JERRY: D_FLAGS word written by %s: %u\n", whoName[who], data);
+//else if (offset == 0xF1A102)
+//     WriteLog("JERRY: D_FLAGS+2 word written by %s: %u\n", whoName[who], data);
 //else if (offset == 0xF10020)
 //     WriteLog("JERRY: JINTCTRL word written by %s: $%04X\n", whoName[who], data);
 #endif
@@ -826,7 +831,7 @@ else if (offset == 0xF10014)
 //NOTE: This should be taken care of in DAC...
        else if (offset == 0xF1A152)                                    // Bottom half of SCLK ($F1A150)
        {
-               WriteLog("JERRY: Writing %04X to SCLK (by %s)...\n", data, whoName[who]);
+               WriteLog("JERRY: Writing $%X to SCLK (by %s)...\n", data, whoName[who]);
 //This should *only* be enabled when SMODE has its INTERNAL bit set! !!! FIX !!!
                JERRYI2SInterruptDivide = (uint8)data;
                JERRYI2SInterruptTimer = -1;
@@ -913,3 +918,15 @@ WriteLog("JERRY: Unhandled timer write %04X (WORD) at %08X by %s...\n", data, of
        jerry_ram_8[(offset+0) & 0xFFFF] = (data >> 8) & 0xFF;
        jerry_ram_8[(offset+1) & 0xFFFF] = data & 0xFF;
 }
+
+int JERRYGetPIT1Frequency(void)
+{
+       int systemClockFrequency = (vjs.hardwareTypeNTSC ? RISC_CLOCK_RATE_NTSC : RISC_CLOCK_RATE_PAL);
+       return systemClockFrequency / ((JERRYPIT1Prescaler + 1) * (JERRYPIT1Divider + 1));
+}
+
+int JERRYGetPIT2Frequency(void)
+{
+       int systemClockFrequency = (vjs.hardwareTypeNTSC ? RISC_CLOCK_RATE_NTSC : RISC_CLOCK_RATE_PAL);
+       return systemClockFrequency / ((JERRYPIT2Prescaler + 1) * (JERRYPIT2Divider + 1));
+}
index 4879c0265778ed3f3d2eb7d73f9254c8bc6b5b45..ec0edbd4732889fb0cd739b8632b760793356b59 100644 (file)
@@ -20,6 +20,9 @@ void JERRYWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 void JERRYExecPIT(uint32 cycles);
 void JERRYI2SExec(uint32 cycles);
 
+int JERRYGetPIT1Frequency(void);
+int JERRYGetPIT2Frequency(void);
+
 // 68000 Interrupt bit positions (enabled at $F10020)
 
 //enum { IRQ2_EXTERNAL = 0, IRQ2_DSP, IRQ2_TIMER1, IRQ2_TIMER2, IRQ2_ASI, IRQ2_SSI };
index 66be33097e6af28452a56a68e62b4b35cacedc34..14b5ff784a8f737cd49b67daee9c06c36d996595 100644 (file)
@@ -3,10 +3,10 @@
 //
 // by cal2
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Cleanups/fixes by James L. Hammons
+// Cleanups/fixes by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index c6abfdc89d20c3dc802c49d4cfd657596c40f543..d21ea682a8582654038966b86800161fb985454c 100644 (file)
@@ -3,10 +3,10 @@
 //
 // Originally by David Raingeard (Cal2)
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Cleanups/new stuff by James L. Hammons
+// Cleanups/new stuff by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index d1890c8e296dde8fe94007a78bd2cbc40c71ec19..fd771ae22457767e605f90de604b96dc74276935 100644 (file)
@@ -13,7 +13,7 @@ AR      := ar
 ARFLAGS := -rs
 
 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
-CFLAGS  := -MMD -O2 -ffast-math -fomit-frame-pointer
+CFLAGS  := -MMD -O2 -ffast-math -fomit-frame-pointer -g
 
 INCS    := -I. -I./obj `sdl-config --cflags`
 
index a4729a819beccc69e5290c1b4b42c6a12a269e54..88f121ba1b975740b3e43ea9bf2c0fb3f3ceec52 100644 (file)
@@ -67,7 +67,7 @@
 /*                     Sommarhack 2010) (see m68000.h)                                                 */
 
 
-const char GenCpu_fileid[] = "Hatari gencpu.c : " __DATE__ " " __TIME__;
+//const char GenCpu_fileid[] = "Hatari gencpu.c : " __DATE__ " " __TIME__;
 
 #include <ctype.h>
 #include <string.h>
index 3c54b67b76e725b5d41d76095dcc155f20064cbe..007f9d696ddcbd2fa3b28925d149662e2f21f0ca 100644 (file)
@@ -236,7 +236,7 @@ unsigned int m68k_disasm(char * output, uint32_t addr, uint32_t * nextpc, int cn
 {
        char f[256], str[256];
        static const char * const ccnames[] =
-               { "T ","F ","HI","LS","CC","CS","NE","EQ",
+               { "RA","RN","HI","LS","CC","CS","NE","EQ",
                  "VC","VS","PL","MI","GE","LT","GT","LE" };
 
        str[0] = 0;
@@ -299,10 +299,10 @@ unsigned int m68k_disasm(char * output, uint32_t addr, uint32_t * nextpc, int cn
 #else
                switch (dp->size)
                {
-                       case sz_byte: strcat(str, ".B "); break;
-                       case sz_word: strcat(str, ".W "); break;
-                       case sz_long: strcat(str, ".L "); break;
-                       default: strcat(str, "   "); break;
+                       case sz_byte: strcat(str, ".B\t"); break;
+                       case sz_word: strcat(str, ".W\t"); break;
+                       case sz_long: strcat(str, ".L\t"); break;
+                       default: strcat(str, "\t"); break;
                }
 #endif
 
@@ -319,7 +319,7 @@ unsigned int m68k_disasm(char * output, uint32_t addr, uint32_t * nextpc, int cn
                {
 //                     sprintf(f, ",");
 //                     strcat(str, f);
-                       strcat(str, ",");
+                       strcat(str, ", ");
                }
 #endif
 
index c6e81021be9e833283dd4266d9f2dec4b4ed3ed7..6f25305092c3ef67ebceb43590c69747ba264ba6 100644 (file)
@@ -1,10 +1,10 @@
 //
 // m68kinterface.c: Code interface to the UAE 68000 core and support code
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2011 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -80,6 +80,8 @@ cpuop_func * cpuFunctionTable[65536];
 void Dasm(uint32_t offset, uint32_t qt)
 {
 #ifdef CPU_DEBUG
+// back up a few instructions...
+//offset -= 100;
        static char buffer[2048];//, mem[64];
        int pc = offset, oldpc;
        uint32_t i;
@@ -100,6 +102,21 @@ void Dasm(uint32_t offset, uint32_t qt)
 #endif
 }
 
+#ifdef CPU_DEBUG
+void DumpRegisters(void)
+{
+       uint32_t i;
+
+       for(i=0; i<16; i++)
+       {
+               printf("%s%i: %08X ", (i < 8 ? "D" : "A"), i & 0x7, regs.regs[i]);
+
+               if ((i & 0x03) == 3)
+                       printf("\n");
+       }
+}
+#endif
+
 
 void m68k_set_cpu_type(unsigned int type)
 {
@@ -261,6 +278,34 @@ else if (regs.pc == 0x803422)
 
 if (inRoutine)
        instSeen++;
+#endif
+// AvP testing... (problem was: 32 bit addresses on 24 bit address cpu--FIXED)
+#if 0
+       static int go = 0;
+
+       if (regs.pc == 0x94BA)
+       {
+               go = 1;
+               printf("\n");
+       }
+
+       if (regs.pc == 0x94C6)
+               go = 0;
+
+//     if (regs.regs[10] == 0xFFFFFFFF && go)
+       if (go)
+       {
+//             printf("A2=-1, PC=%08X\n", regs.pc);
+//             go = 0;
+//             Dasm(regs.pc, 130);
+               Dasm(regs.pc, 1);
+               DumpRegisters();
+       }
+//94BA: 2468 0000                MOVEA.L       (A0,$0000) == $0002328A, A2
+//94BE: 200A                     MOVE.L        A2, D0
+//94C0: 6A02                     BPL.B $94C4
+//94C2: 2452                     MOVEA.L       (A2), A2                        ; <--- HERE
+//94C4: 4283                     CLR.L D3
 #endif
                uint32_t opcode = get_iword(0);
 //if ((opcode & 0xFFF8) == 0x31C0)
index 9cd456fad73b06be5a05fe6c41418fd53e7aa053..9605d6e3e2ecb4fae49b1d33c70de584afe22e52 100644 (file)
@@ -29,7 +29,7 @@
 %
 % Fields on a line: 
 % 16 chars bitpattern : 
-% CPU level / privildge level :
+% CPU level / privilege level :
 %   CPU level 0: 68000
 %             1: 68010
 %             2: 68020
index 0d9d253ae1c788322586f906d2676ab77cba86ee..6d57ca3e09c0064c40fb8976069d169ac0854b16 100644 (file)
@@ -1,9 +1,9 @@
 //
 // Jaguar memory and I/O physical (hosted!) memory
 //
-// by James L. Hammons
+// by James Hammons
 //
-// JLH = James L. Hammons
+// JLH = James Hammons
 //
 // WHO  WHEN        WHAT
 // ---  ----------  -----------------------------------------------------------
index dcd63631da9457e2d14b822b87efc1d74388c198..67c9b8ab7d7705f88c3c2ee2d0b394e08a956108 100644 (file)
@@ -3,9 +3,9 @@
 //
 // Jaguar Memory Manager Unit
 //
-// by James L. Hammons
+// by James Hammons
 //
-// JLH = James L. Hammons
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  -----------------------------------------------------------
index ba8a1b4312d17d3f94992eb28cca908550786e97..778bf7465bfec870e8deb8e0f48e60fdfc2995d1 100644 (file)
@@ -3,10 +3,10 @@
 //
 // Original source by David Raingeard (Cal2)
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Extensive cleanups/fixes/rewrites by James L. Hammons
+// Extensive cleanups/fixes/rewrites by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 977e925320897801e9ce18f23d02eeb8aa55e787..b1f864fbdea01179801e0920f706b853a4de1ca7 100644 (file)
@@ -1,10 +1,10 @@
 //
 // SETTINGS.CPP: Virtual Jaguar configuration loading/saving support
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 1e0552013c83e502b29762759254f18c49b53e8b..10fe306d957a2f72db7dce14a2b59dd940878943 100644 (file)
@@ -1,10 +1,10 @@
 //
 // state.cpp: VJ machine state save/load support
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index 8a7ec27054cfcd0b171c28773134e70bbdde68d2..97d993e399a8301f841798b59a1515e37738c8bf 100644 (file)
@@ -3,10 +3,10 @@
 //
 // Originally by David Raingeard (cal2)
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Cleanups and endian wrongness amelioration by James L. Hammons
+// Cleanups and endian wrongness amelioration by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
 // Also note that VC is in *half* lines, i.e. divide by 2 to get the scanline
 /*#define LEFT_VISIBLE_HC                      208
 #define RIGHT_VISIBLE_HC               1528//*/
-#define LEFT_VISIBLE_HC                        208
-#define RIGHT_VISIBLE_HC               1488
+// These were right for Rayman, but that one is offset on a real TV too.
+//#define LEFT_VISIBLE_HC                      208
+//#define RIGHT_VISIBLE_HC             1488
+// This is more like a real TV display...
+//#define LEFT_VISIBLE_HC                      (208 - 32)
+//#define RIGHT_VISIBLE_HC             (1488 - 32)
+// Split the difference? (Seems to be OK for the most part...)
+#define LEFT_VISIBLE_HC                        (208 - 16)
+#define RIGHT_VISIBLE_HC               (1488 - 16)
 //#define TOP_VISIBLE_VC               25
 //#define BOTTOM_VISIBLE_VC            503
 #define TOP_VISIBLE_VC                 31
 //Are these PAL horizontals correct?
 //They seem to be for the most part, but there are some games that seem to be
 //shifted over to the right from this "window".
-#define LEFT_VISIBLE_HC_PAL            208
-#define RIGHT_VISIBLE_HC_PAL   1488
+#define LEFT_VISIBLE_HC_PAL            (208 - 16)
+#define RIGHT_VISIBLE_HC_PAL   (1488 - 16)
 #define TOP_VISIBLE_VC_PAL             67
 #define BOTTOM_VISIBLE_VC_PAL  579
 
index 7b2a694d7c48cfe78f44ad6964becf0d5e74d536..cad30bf934939f1e950be37ff7b2d164c88e4c96 100644 (file)
@@ -1,6 +1,6 @@
 //
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Removal of unsafe macros and addition of typdefs by James L. Hammons
+// Removal of unsafe macros and addition of typdefs by James Hammons
 //
 
 #ifndef __TYPES_H__
index a622d13cdd4c93de6c0c02da16b873b58afc4267..dff42d3c9f1bd18122d1188ee2bc0a28ee95a60b 100644 (file)
@@ -3,7 +3,7 @@
 //
 // (C) 2011 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -11,7 +11,7 @@
 //
 
 //
-// This file was automagically generated by bin2c (by James L. Hammons)
+// This file was automagically generated by bin2c (by James Hammons)
 //
 
 unsigned char universalCartHeader[0x2000] = {
index 0aa231f0128ef92a5f0beb3c18cde1a7b044bab2..e28e7d44d519c15117b0225c903e42a6127fcdef 100644 (file)
@@ -2,10 +2,10 @@
 // ZIP file support (mostly ripped from MAME--thx MAME team!)
 // Mostly this is here to simplify interfacing to zlib...
 //
-// Added by James L. Hammons
+// Added by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index e29f65b3a47200aa58c7c231818d7483df06761c..8700c35beed6dd1e19e351e48a7891723ed1f5d9 100644 (file)
@@ -3,7 +3,7 @@
 //
 // Original codebase by David Raingeard (Cal2)
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Cleanups/fixes/enhancements by James L. Hammons and Adam Green
+// Cleanups/fixes/enhancements by James Hammons and Adam Green
 //
 
 #include <SDL.h>
@@ -51,7 +51,7 @@ int main_old(int argc, char * argv[])
 #endif
        printf("Based upon Virtual Jaguar core v1.0.0 by David Raingeard.\n");
        printf("Written by Niels Wagenaar (Linux/WIN32), Carwin Jones (BeOS),\n");
-       printf("James L. Hammons (WIN32) and Adam Green (MacOS)\n");
+       printf("James Hammons (WIN32) and Adam Green (MacOS)\n");
        printf("Contact: http://sdlemu.ngemu.com/ | sdlemu@ngemu.com\n");
 
        bool haveCart = false;                                                  // Assume there is no cartridge...!
index c9998cdd37ba1c13e21b9b7ff46da4baf4704e9a..7f576e6d74b610326039b438a7a37a0312661de7 100644 (file)
@@ -3,7 +3,7 @@
 //
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
index aa65a916f527293fe9ba06bcd9b63e755eb6085a..11f5d6ff435d99745b77a8467df23e734f0a71c4 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Virtual Jaguar Qt project file
 #
-# by James L. Hammons
+# by James Hammons
 # Copyright (C) 2011 Underground Software
 #
 # See the README and GPLv3 files for licensing and warranty information
@@ -15,8 +15,8 @@
 TARGET     = virtualjaguar
 CONFIG    += qt warn_on release debug
 RESOURCES += virtualjaguar.qrc
-#LIBS      += -lz -Lobj -ljaguarcore -lmusashi
-LIBS      += -lz -Lobj -ljaguarcore -lm68k
+#LIBS      += -Lobj -ljaguarcore -lz -lmusashi
+LIBS      += -Lobj -ljaguarcore -lz -lm68k
 QT        += opengl
 
 # We stuff all the intermediate crap into obj/ so it won't confuse us mere mortals ;-)