* 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
uint32 jaguarMainROMCRC32, jaguarROMSize, jaguarRunAddress;
bool jaguarCartInserted = false;
+bool lowerField = false;
#ifdef CPU_DEBUG_MEMORY
uint8 writeMemMax[0x400000], writeMemMin[0x400000];
//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();
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);
// 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.
// 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...
//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();
#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)", "?", "?", "?" };
//
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:
// 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();