From f30bf746981a99079e766b0d4e9de5391a4175ff Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Fri, 27 Jan 2012 10:16:43 +0000 Subject: [PATCH] Initial fixes for audio subsystem. Fragile; may break in unexpected ways. --- Makefile | 4 +- docs/INSTALL | 2 +- docs/README | 4 +- docs/TODO | 2 + docs/WHATSNEW | 11 ++++- jaguarcore.mak | 2 +- musashi.mak | 2 +- src/blitter.cpp | 4 +- src/cdintf.cpp | 4 +- src/cdrom.cpp | 4 +- src/crc32.cpp | 4 +- src/dac.cpp | 43 ++++++++++++++-- src/dac.h | 2 + src/dsp.cpp | 32 ++++++++++-- src/eeprom.cpp | 4 +- src/event.cpp | 4 +- src/file.cpp | 4 +- src/filedb.cpp | 4 +- src/gpu.cpp | 4 +- src/gui/about.cpp | 8 +-- src/gui/alpinetab.cpp | 2 +- src/gui/app.cpp | 13 +++-- src/gui/configdialog.cpp | 4 +- src/gui/controllertab.cpp | 2 +- src/gui/controllerwidget.cpp | 2 +- src/gui/filelistmodel.cpp | 4 +- src/gui/filepicker.cpp | 24 ++++----- src/gui/filethread.cpp | 4 +- src/gui/generaltab.cpp | 2 +- src/gui/glwidget.cpp | 4 +- src/gui/imagedelegate.cpp | 4 +- src/gui/keygrabber.cpp | 4 +- src/gui/mainwin.cpp | 9 ++-- src/jagbios.cpp | 2 +- src/jagcdbios.cpp | 2 +- src/jagdasm.cpp | 5 +- src/jagdevcdbios.cpp | 2 +- src/jagstub1bios.cpp | 2 +- src/jagstub2bios.cpp | 2 +- src/jaguar.cpp | 95 +++++++++++++++++++++++++++++++++--- src/jerry.cpp | 23 +++++++-- src/jerry.h | 3 ++ src/joystick.cpp | 4 +- src/log.cpp | 4 +- src/m68000/Makefile | 2 +- src/m68000/gencpu.c | 2 +- src/m68000/m68kdasm.c | 12 ++--- src/m68000/m68kinterface.c | 49 ++++++++++++++++++- src/m68000/table68k | 2 +- src/memory.cpp | 4 +- src/mmu.cpp | 4 +- src/op.cpp | 4 +- src/settings.cpp | 4 +- src/state.cpp | 4 +- src/tom.cpp | 19 +++++--- src/types.h | 2 +- src/universalhdr.cpp | 4 +- src/unzip.c | 4 +- src/virtualjaguar.cpp | 4 +- src/wavetable.cpp | 2 +- virtualjaguar.pro | 6 +-- 61 files changed, 367 insertions(+), 131 deletions(-) diff --git a/Makefile b/Makefile index 761360a..03de51b 100644 --- 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" diff --git a/docs/INSTALL b/docs/INSTALL index a5a7b57..fcb6f3a 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -1,5 +1,5 @@ ---------------------------------------- -Virtual Jaguar v2.0.2 Qt release INSTALL +Virtual Jaguar v2.0.3 Qt release INSTALL ---------------------------------------- diff --git a/docs/README b/docs/README index 9f75f91..aed97e1 100644 --- a/docs/README +++ b/docs/README @@ -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! :) diff --git a/docs/TODO b/docs/TODO index ed4b68b..f8276af 100644 --- 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 diff --git a/docs/WHATSNEW b/docs/WHATSNEW index 7019f55..3cfcd9a 100644 --- a/docs/WHATSNEW +++ b/docs/WHATSNEW @@ -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 diff --git a/jaguarcore.mak b/jaguarcore.mak index 7d0ef6f..16e0b1e 100644 --- a/jaguarcore.mak +++ b/jaguarcore.mak @@ -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. ;-) diff --git a/musashi.mak b/musashi.mak index 869b19b..9aa460b 100644 --- a/musashi.mak +++ b/musashi.mak @@ -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. ;-) diff --git a/src/blitter.cpp b/src/blitter.cpp index 3db442f..4e8ea74 100644 --- a/src/blitter.cpp +++ b/src/blitter.cpp @@ -1,10 +1,10 @@ // // Blitter core // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/cdintf.cpp b/src/cdintf.cpp index 8973c45..1f0993b 100644 --- a/src/cdintf.cpp +++ b/src/cdintf.cpp @@ -1,10 +1,10 @@ // // OS agnostic CDROM interface functions // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/cdrom.cpp b/src/cdrom.cpp index c45a8f0..3f41981 100644 --- a/src/cdrom.cpp +++ b/src/cdrom.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/crc32.cpp b/src/crc32.cpp index 8cb637b..1886971 100644 --- a/src/crc32.cpp +++ b/src/crc32.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/dac.cpp b/src/dac.cpp index dbb1b58..617918a 100644 --- a/src/dac.cpp +++ b/src/dac.cpp @@ -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 +// JLH = James Hammons // // 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) // diff --git a/src/dac.h b/src/dac.h index ac94d06..023855f 100644 --- 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 diff --git a/src/dsp.cpp b/src/dsp.cpp index 168ea3a..74839cc 100644 --- a/src/dsp.cpp +++ b/src/dsp.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- @@ -18,6 +18,7 @@ #include // Used only for SDL_GetTicks... #include +#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++) { diff --git a/src/eeprom.cpp b/src/eeprom.cpp index 4b8dda8..bba94af 100644 --- a/src/eeprom.cpp +++ b/src/eeprom.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/event.cpp b/src/event.cpp index e0daebb..b455cd6 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -1,10 +1,10 @@ // // System time handlers // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/file.cpp b/src/file.cpp index 71f33e7..acf90d6 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -2,10 +2,10 @@ // FILE.CPP // // File support -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/filedb.cpp b/src/filedb.cpp index eadfda7..d910583 100644 --- a/src/filedb.cpp +++ b/src/filedb.cpp @@ -1,10 +1,10 @@ // // filedb.cpp - File database // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/gpu.cpp b/src/gpu.cpp index 93a32d9..2ea973d 100644 --- a/src/gpu.cpp +++ b/src/gpu.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/gui/about.cpp b/src/gui/about.cpp index 1e11561..5cf1ade 100644 --- a/src/gui/about.cpp +++ b/src/gui/about.cpp @@ -1,10 +1,10 @@ // // about.cpp - Credits // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- @@ -39,8 +39,8 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog) "Version: " VJ_RELEASE_VERSION " (" VJ_RELEASE_SUBVERSION ")" "" - "Coders: James L. Hammons (shamus)
Niels Wagenaar (nwagenaar)
Carwin Jones (Caz)
Adam Green" - "Testers: Cyrano Jones, Robert R, TheUMan, Dissection,
overridex, geormetal" + "Coders: James Hammons (shamus)
Niels Wagenaar (nwagenaar)
Carwin Jones (Caz)
Adam Green" + "Testers: Cyrano Jones, LinkoVitch, neo-rg, Robert R,
TheUMan, Dissection, overridex, geormetal" "Build Team: ggn (win32)
LinkoVitch, goldenegg (MacOS)" "Homepage: http://icculus.org/virtualjaguar/" "" diff --git a/src/gui/alpinetab.cpp b/src/gui/alpinetab.cpp index 7701687..d3e35f6 100644 --- a/src/gui/alpinetab.cpp +++ b/src/gui/alpinetab.cpp @@ -5,7 +5,7 @@ // (C) 2011 Underground Software // See the README and GPLv3 files for licensing and warranty information // -// JLH = James L. Hammons +// JLH = James Hammons // // WHO WHEN WHAT // --- ---------- ------------------------------------------------------------ diff --git a/src/gui/app.cpp b/src/gui/app.cpp index aad90fe..7c2037f 100644 --- a/src/gui/app.cpp +++ b/src/gui/app.cpp @@ -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 +// JLH = James Hammons // // 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(); - 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) { diff --git a/src/gui/configdialog.cpp b/src/gui/configdialog.cpp index f75fbf1..709940c 100644 --- a/src/gui/configdialog.cpp +++ b/src/gui/configdialog.cpp @@ -1,10 +1,10 @@ // // configdialog.cpp - Configuration dialog // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/gui/controllertab.cpp b/src/gui/controllertab.cpp index 34ca155..957e568 100644 --- a/src/gui/controllertab.cpp +++ b/src/gui/controllertab.cpp @@ -5,7 +5,7 @@ // (C) 2011 Underground Software // See the README and GPLv3 files for licensing and warranty information // -// JLH = James L. Hammons +// JLH = James Hammons // // WHO WHEN WHAT // --- ---------- ------------------------------------------------------------ diff --git a/src/gui/controllerwidget.cpp b/src/gui/controllerwidget.cpp index fd9ebf2..bbdafa2 100644 --- a/src/gui/controllerwidget.cpp +++ b/src/gui/controllerwidget.cpp @@ -5,7 +5,7 @@ // (C) 2011 Underground Software // See the README and GPLv3 files for licensing and warranty information // -// JLH = James L. Hammons +// JLH = James Hammons // // WHO WHEN WHAT // --- ---------- ------------------------------------------------------------ diff --git a/src/gui/filelistmodel.cpp b/src/gui/filelistmodel.cpp index 00bb0bb..36b32b5 100644 --- a/src/gui/filelistmodel.cpp +++ b/src/gui/filelistmodel.cpp @@ -1,10 +1,10 @@ // // filelistmodel.cpp - A ROM chooser // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/gui/filepicker.cpp b/src/gui/filepicker.cpp index 2082ee9..67eb5fd 100644 --- a/src/gui/filepicker.cpp +++ b/src/gui/filepicker.cpp @@ -1,10 +1,10 @@ // // filepicker.cpp - A ROM chooser // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // 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 diff --git a/src/gui/filethread.cpp b/src/gui/filethread.cpp index 0351908..bde97ed 100644 --- a/src/gui/filethread.cpp +++ b/src/gui/filethread.cpp @@ -1,10 +1,10 @@ // // filethread.cpp - File discovery thread // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/gui/generaltab.cpp b/src/gui/generaltab.cpp index 883f137..c71b1c3 100644 --- a/src/gui/generaltab.cpp +++ b/src/gui/generaltab.cpp @@ -5,7 +5,7 @@ // (C) 2011 Underground Software // See the README and GPLv3 files for licensing and warranty information // -// JLH = James L. Hammons +// JLH = James Hammons // // WHO WHEN WHAT // --- ---------- ------------------------------------------------------------ diff --git a/src/gui/glwidget.cpp b/src/gui/glwidget.cpp index e09ebd2..7473707 100644 --- a/src/gui/glwidget.cpp +++ b/src/gui/glwidget.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/gui/imagedelegate.cpp b/src/gui/imagedelegate.cpp index e7ab711..06fb43e 100644 --- a/src/gui/imagedelegate.cpp +++ b/src/gui/imagedelegate.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/gui/keygrabber.cpp b/src/gui/keygrabber.cpp index 23954b8..694be3c 100644 --- a/src/gui/keygrabber.cpp +++ b/src/gui/keygrabber.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index af1dab1..56299f3 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -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 +// JLH = James Hammons // // 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(); } } diff --git a/src/jagbios.cpp b/src/jagbios.cpp index 7d9706d..3633346 100644 --- a/src/jagbios.cpp +++ b/src/jagbios.cpp @@ -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] = { diff --git a/src/jagcdbios.cpp b/src/jagcdbios.cpp index e6c55a8..eea4cf0 100644 --- a/src/jagcdbios.cpp +++ b/src/jagcdbios.cpp @@ -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] = { diff --git a/src/jagdasm.cpp b/src/jagdasm.cpp index 6fadae8..5f18f11 100644 --- a/src/jagdasm.cpp +++ b/src/jagdasm.cpp @@ -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; } diff --git a/src/jagdevcdbios.cpp b/src/jagdevcdbios.cpp index 389fc9f..85dbe91 100644 --- a/src/jagdevcdbios.cpp +++ b/src/jagdevcdbios.cpp @@ -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] = { diff --git a/src/jagstub1bios.cpp b/src/jagstub1bios.cpp index 83de7b4..80fdd43 100644 --- a/src/jagstub1bios.cpp +++ b/src/jagstub1bios.cpp @@ -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] = { diff --git a/src/jagstub2bios.cpp b/src/jagstub2bios.cpp index 500675f..884680a 100644 --- a/src/jagstub2bios.cpp +++ b/src/jagstub2bios.cpp @@ -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] = { diff --git a/src/jaguar.cpp b/src/jaguar.cpp index f456787..b6c9f19 100644 --- a/src/jaguar.cpp +++ b/src/jaguar.cpp @@ -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); } // diff --git a/src/jerry.cpp b/src/jerry.cpp index 484fe01..cba9571 100644 --- a/src/jerry.cpp +++ b/src/jerry.cpp @@ -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 // // WHO WHEN WHAT // --- ---------- ----------------------------------------------------------- @@ -164,6 +164,7 @@ #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)); +} diff --git a/src/jerry.h b/src/jerry.h index 4879c02..ec0edbd 100644 --- a/src/jerry.h +++ b/src/jerry.h @@ -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 }; diff --git a/src/joystick.cpp b/src/joystick.cpp index 66be330..14b5ff7 100644 --- a/src/joystick.cpp +++ b/src/joystick.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/log.cpp b/src/log.cpp index c6abfdc..d21ea68 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/m68000/Makefile b/src/m68000/Makefile index d1890c8..fd771ae 100644 --- a/src/m68000/Makefile +++ b/src/m68000/Makefile @@ -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` diff --git a/src/m68000/gencpu.c b/src/m68000/gencpu.c index a4729a8..88f121b 100644 --- a/src/m68000/gencpu.c +++ b/src/m68000/gencpu.c @@ -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 #include diff --git a/src/m68000/m68kdasm.c b/src/m68000/m68kdasm.c index 3c54b67..007f9d6 100644 --- a/src/m68000/m68kdasm.c +++ b/src/m68000/m68kdasm.c @@ -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 diff --git a/src/m68000/m68kinterface.c b/src/m68000/m68kinterface.c index c6e8102..6f25305 100644 --- a/src/m68000/m68kinterface.c +++ b/src/m68000/m68kinterface.c @@ -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 +// JLH = James Hammons // // 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) diff --git a/src/m68000/table68k b/src/m68000/table68k index 9cd456f..9605d6e 100644 --- a/src/m68000/table68k +++ b/src/m68000/table68k @@ -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 diff --git a/src/memory.cpp b/src/memory.cpp index 0d9d253..6d57ca3 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -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 // --- ---------- ----------------------------------------------------------- diff --git a/src/mmu.cpp b/src/mmu.cpp index dcd6363..67c9b8a 100644 --- a/src/mmu.cpp +++ b/src/mmu.cpp @@ -3,9 +3,9 @@ // // Jaguar Memory Manager Unit // -// by James L. Hammons +// by James Hammons // -// JLH = James L. Hammons +// JLH = James Hammons // // WHO WHEN WHAT // --- ---------- ----------------------------------------------------------- diff --git a/src/op.cpp b/src/op.cpp index ba8a1b4..778bf74 100644 --- a/src/op.cpp +++ b/src/op.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/settings.cpp b/src/settings.cpp index 977e925..b1f864f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/state.cpp b/src/state.cpp index 1e05520..10fe306 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/tom.cpp b/src/tom.cpp index 8a7ec27..97d993e 100644 --- a/src/tom.cpp +++ b/src/tom.cpp @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- @@ -314,8 +314,15 @@ // 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 @@ -324,8 +331,8 @@ //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 diff --git a/src/types.h b/src/types.h index 7b2a694..cad30bf 100644 --- a/src/types.h +++ b/src/types.h @@ -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__ diff --git a/src/universalhdr.cpp b/src/universalhdr.cpp index a622d13..dff42d3 100644 --- a/src/universalhdr.cpp +++ b/src/universalhdr.cpp @@ -3,7 +3,7 @@ // // (C) 2011 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // 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] = { diff --git a/src/unzip.c b/src/unzip.c index 0aa231f..e28e7d4 100644 --- a/src/unzip.c +++ b/src/unzip.c @@ -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 +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/src/virtualjaguar.cpp b/src/virtualjaguar.cpp index e29f65b..8700c35 100644 --- a/src/virtualjaguar.cpp +++ b/src/virtualjaguar.cpp @@ -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 @@ -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...! diff --git a/src/wavetable.cpp b/src/wavetable.cpp index c9998cd..7f576e6 100644 --- a/src/wavetable.cpp +++ b/src/wavetable.cpp @@ -3,7 +3,7 @@ // // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- diff --git a/virtualjaguar.pro b/virtualjaguar.pro index aa65a91..11f5d6f 100644 --- a/virtualjaguar.pro +++ b/virtualjaguar.pro @@ -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 ;-) -- 2.37.2