]> Shamusworld >> Repos - virtualjaguar/commitdiff
Fixed VC to act like a real Jaguar. :-)
authorShamus Hammons <jlhamm@acm.org>
Fri, 23 Dec 2011 12:56:29 +0000 (12:56 +0000)
committerShamus Hammons <jlhamm@acm.org>
Fri, 23 Dec 2011 12:56:29 +0000 (12:56 +0000)
docs/TODO
docs/WHATSNEW
src/jaguar.cpp
src/op.cpp
src/tom.cpp

index 484709d82375996e02ef857008a7cfaf3cf289b9..ed4b68b1ca12b8859a295ea670305afb3ecc042b 100644 (file)
--- 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
index 68ece940736eb30c257eae51c48129a9c67113af..7019f5573abf1760086e1aea3ecc9b190abd2677 100644 (file)
@@ -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
index df4c139afc4ab061396301cacdd93a2bf2aa118e..f623817e98956273f09d404d911a0544e3aafd5a 100644 (file)
@@ -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();
index 62be06681901ac49a6f311e5298a3cb20bcc7645..ba8a1b4312d17d3f94992eb28cca908550786e97 100644 (file)
@@ -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)", "?", "?", "?" };
index 92280923fb57fb23576b07b582dd81f454594b6e..8a7ec27054cfcd0b171c28773134e70bbdde68d2 100644 (file)
@@ -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();