From 7a92a3a54da8634b6765fafd8e5a5724838941b1 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Thu, 5 Jan 2012 17:07:05 +0000 Subject: [PATCH] 2.0.2 release. --- Makefile | 8 ++-- docs/TODO | 2 + docs/WHATSNEW | 2 +- src/gui/about.cpp | 2 +- src/gui/app.cpp | 9 ++-- src/gui/filepicker.cpp | 20 ++++----- src/gui/mainwin.cpp | 5 ++- src/jaguar.cpp | 87 +++++++++++++++++++++++++++++++++++--- src/m68000/Makefile | 2 +- src/m68000/gencpu.c | 2 +- src/m68000/m68kdasm.c | 4 ++ src/m68000/m68kinterface.c | 45 ++++++++++++++++++++ 12 files changed, 161 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 761360a..59adb8b 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_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_VERSION \"v2.0.2\"" > 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 virtualjaguar: sources libs makefile-qt @echo -e "\033[01;33m***\033[00;32m Making Virtual Jaguar GUI...\033[00m" 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..4bd7332 100644 --- a/docs/WHATSNEW +++ b/docs/WHATSNEW @@ -8,7 +8,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/src/gui/about.cpp b/src/gui/about.cpp index 1e11561..c00711a 100644 --- a/src/gui/about.cpp +++ b/src/gui/about.cpp @@ -40,7 +40,7 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog) 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" + "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/app.cpp b/src/gui/app.cpp index aad90fe..d687516 100644 --- a/src/gui/app.cpp +++ b/src/gui/app.cpp @@ -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/filepicker.cpp b/src/gui/filepicker.cpp index 2082ee9..eeec7f4 100644 --- a/src/gui/filepicker.cpp +++ b/src/gui/filepicker.cpp @@ -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/mainwin.cpp b/src/gui/mainwin.cpp index af1dab1..3cf2ec5 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -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/jaguar.cpp b/src/jaguar.cpp index f456787..e6fd3b6 100644 --- a/src/jaguar.cpp +++ b/src/jaguar.cpp @@ -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,8 @@ 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); } // 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..63c65dd 100644 --- a/src/m68000/m68kdasm.c +++ b/src/m68000/m68kdasm.c @@ -234,6 +234,10 @@ int32_t ShowEA(FILE * f, int reg, amodes mode, wordsizes size, char * buf) //void m68k_disasm(FILE * f, uint32_t addr, uint32_t * nextpc, int cnt) unsigned int m68k_disasm(char * output, uint32_t addr, uint32_t * nextpc, int cnt) { + // Sanity checking... +// if (addr > 0xFFFFFF) +// addr = 0; + char f[256], str[256]; static const char * const ccnames[] = { "T ","F ","HI","LS","CC","CS","NE","EQ", diff --git a/src/m68000/m68kinterface.c b/src/m68000/m68kinterface.c index c6e8102..132a91a 100644 --- a/src/m68000/m68kinterface.c +++ b/src/m68000/m68kinterface.c @@ -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) -- 2.37.2