From: Shamus Hammons Date: Fri, 23 Dec 2011 12:56:29 +0000 (+0000) Subject: Fixed VC to act like a real Jaguar. :-) X-Git-Tag: 2.0.2~2 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec46f1b3c40cf464d833e360346b4f6f8379b9ae;p=virtualjaguar Fixed VC to act like a real Jaguar. :-) --- diff --git a/docs/TODO b/docs/TODO index 484709d..ed4b68b 100644 --- a/docs/TODO +++ b/docs/TODO @@ -14,6 +14,9 @@ Stuff to add/fix for the next release of Virtual Jaguar - Need to propagate blitter fixes in the A1 <- A2 direction to the A1 -> A2 direction and the GPU fixes to various instructions to the DSP. [Shamus] - Blitter needs fixing. [Shamus] +- Command line switches for frontends. [Shamus] +- In emulator screenshots. [Shamus] +- Audio/video dumping. [Shamus] Stuff that was added/fixed diff --git a/docs/WHATSNEW b/docs/WHATSNEW index 68ece94..7019f55 100644 --- a/docs/WHATSNEW +++ b/docs/WHATSNEW @@ -4,6 +4,11 @@ Virtual Jaguar v2.0.2 GCC/Qt * Fixed problem on OP with 24BPP bitmaps. [Shamus] * Cosmetic GUI fixes. [Shamus] * Switched to UAE 68000 CPU core. [Shamus] +* Fixed some RISC STORE and LOAD alignment issues. Still need to verify against + 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] Virtual Jaguar v2.0.1 GCC/Qt diff --git a/src/jaguar.cpp b/src/jaguar.cpp index df4c139..f623817 100644 --- a/src/jaguar.cpp +++ b/src/jaguar.cpp @@ -68,6 +68,7 @@ uint32 jaguar_active_memory_dumps = 0; uint32 jaguarMainROMCRC32, jaguarROMSize, jaguarRunAddress; bool jaguarCartInserted = false; +bool lowerField = false; #ifdef CPU_DEBUG_MEMORY uint8 writeMemMax[0x400000], writeMemMin[0x400000]; @@ -1650,6 +1651,7 @@ 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 m68k_set_cpu_type(M68K_CPU_TYPE_68000); GPUInit(); @@ -1683,6 +1685,7 @@ void JaguarReset(void) m68k_pulse_reset(); // Reset the 68000 WriteLog("Jaguar: 68K reset. PC=%06X SP=%08X\n", m68k_get_reg(NULL, M68K_REG_PC), m68k_get_reg(NULL, M68K_REG_A7)); + lowerField = false; // Reset the lower field flag // New timer base code stuffola... InitializeEventList(); // SetCallbackTime(ScanlineCallback, 63.5555); @@ -1957,7 +1960,8 @@ void JaguarExecuteNew(void) // The thing to keep in mind is that the VC is advanced every HALF line, regardless // of whether the display is interlaced or not. The only difference with an // interlaced display is that the high bit of VC will be set when the lower -// field is being rendered. +// field is being rendered. (NB: The high bit of VC is ALWAYS set on the lower field, +// regardless of whether it's in interlace mode or not.) // // Normally, TVs will render a full frame in 1/30s (NTSC) or 1/25s (PAL) by // rendering two fields that are slighty vertically offset from each other. @@ -1988,18 +1992,26 @@ void HalflineCallback(void) // So we cut the number of half-lines in a frame in half. :-P uint16 numHalfLines = ((vjs.hardwareTypeNTSC ? 525 : 625) * 2) / 2; - if (vc >= numHalfLines) + if ((vc & 0x7FF) >= numHalfLines) #else - if (vc >= vp) + if ((vc & 0x7FF) >= vp) #endif + { vc = 0; + lowerField = !lowerField; + + // If we're rendering the lower field, set the high bit (#12, counting + // from 1) of VC + if (lowerField) + vc = 0x0800; + } //WriteLog("SLC: Currently on line %u (VP=%u)...\n", vc, vp); TOMWriteWord(0xF00006, vc, JAGUAR); //This is a crappy kludge, but maybe it'll work for now... //Maybe it's not so bad, since the IRQ happens on a scanline boundary... - if (vc == vi && vc > 0 && TOMIRQEnabled(IRQ_VIDEO)) // Time for Vertical Interrupt? + if ((vc & 0x7FF) == vi && (vc & 0x7FF) > 0 && TOMIRQEnabled(IRQ_VIDEO)) // Time for Vertical Interrupt? { // We don't have to worry about autovectors & whatnot because the Jaguar // tells you through its HW registers who sent the interrupt... @@ -2011,7 +2023,7 @@ void HalflineCallback(void) //Change this to VBB??? //Doesn't seem to matter (at least for Flip Out & I-War) - if (vc == 0) + if ((vc & 0x7FF) == 0) // if (vc == vbb) { JoystickExec(); diff --git a/src/op.cpp b/src/op.cpp index 62be066..ba8a1b4 100644 --- a/src/op.cpp +++ b/src/op.cpp @@ -429,6 +429,10 @@ void DumpBitmapCore(uint64 p0, uint64 p1) #warning "Need to fix this so that when an GPU object IRQ happens, we can pick up OP processing where we left off. !!! FIX !!!" void OPProcessList(int halfline, bool render) { +#warning "!!! NEED TO HANDLE MULTIPLE FIELDS PROPERLY !!! +// We ignore them, for now; not good + halfline &= 0x7FF; + extern int op_start_log; // char * condition_to_str[8] = // { "==", "<", ">", "(opflag set)", "(second half line)", "?", "?", "?" }; diff --git a/src/tom.cpp b/src/tom.cpp index 9228092..8a7ec27 100644 --- a/src/tom.cpp +++ b/src/tom.cpp @@ -778,10 +778,14 @@ void tom_render_16bpp_rgb_scanline(uint32 * backbuffer) // void TOMExecHalfline(uint16 halfline, bool render) { +#warning "!!! Need to handle multiple fields properly !!!" + // We ignore the problem for now + halfline &= 0x7FF; + bool inActiveDisplayArea = true; //Interlacing is still not handled correctly here... !!! FIX !!! - if (halfline & 0x01) // Execute OP only on even lines (non-interlaced only!) + if (halfline & 0x01) // Execute OP only on even halflines (non-interlaced only!) return; //Hm, it seems that the OP needs to execute from zero, so let's try it: @@ -1108,6 +1112,50 @@ uint32 TOMGetVideoModeHeight(void) // TOM reset code // Now PAL friendly! // +/* +The values in TOMReset come from the Jaguar BIOS. +These values are from BJL: + +NSTC: +CLK2 181 +HP 844 +HBB 1713 +HBE 125 +HS 1741 +HVS 651 +HEQ 784 +HDE 1696 +HDB1 166 +HDB2 166 +VP 523 +VEE 6 +VBE 24 +VDB 46 +VDE 496 +VBB 500 +VEB 511 +VS 517 + +PAL: +CLK2 226 +HP 850 +HBB 1711 +HBE 158 +HS 1749 +HVS 601 +HEQ 787 +HDE 1696 +HDB1 166 +HDB2 166 +VP 625 +VEE 6 +VBE 34 +VDB 46 +VDE 429 +VBB 600 +VEB 613 +VS 618 +*/ void TOMReset(void) { OPReset();