//
// Object Processor main routine
//
-//Need to fix this so that when an GPU object IRQ happens, we can pick up OP processing
-//where we left off. !!! FIX !!!
#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 scanline, bool render)
{
int bitmapCounter = 0;
// *** END OP PROCESSOR TESTING ONLY ***
- uint32 opCyclesToRun = 10000; // This is a pulled-out-of-the-air value (will need to be fixed, obviously!)
+ uint32 opCyclesToRun = 30000; // This is a pulled-out-of-the-air value (will need to be fixed, obviously!)
// if (op_pointer) WriteLog(" new op list at 0x%.8x scanline %i\n",op_pointer,scanline);
while (op_pointer)
ypos = TOMReadWord(0xF00046, OP) / 2; // Get the VDB value
#endif
// Actually, no. Any item less than VDB will get only the lines that hang over VDB displayed.
-// So we need to fix this somehow... (and it has... in tom.cpp :-P)
+// Actually, this is incorrect. It seems that VDB value is wrong somewhere and that's
+// what's causing things to fuck up. Still no idea why.
uint32 height = (p0 & 0xFFC000) >> 14;
uint32 oldOPP = op_pointer - 8;
if (!render || iwidth == 0)
return;
+//OK, so we know the position in the line buffer is correct. It's the clipping in
+//24bpp mode that's wrong!
+#if 0
+//This is a total kludge, based upon the fact that 24BPP mode puts *4* bytes
+//into the line buffer for each pixel.
+if (depth == 5) // i.e., 24bpp mode...
+ xpos >>= 1; // Cut it in half...
+#endif
+
//#define OP_DEBUG_BMP
//#ifdef OP_DEBUG_BMP
// WriteLog("bitmap %ix%i %ibpp at %i,%i firstpix=%i data=0x%.8x pitch %i hflipped=%s dwidth=%i (linked to 0x%.8x) Transluency=%s\n",
// Not sure if this is Jaguar Two only location or what...
// From the docs, it is... If we want to limit here we should think of something else.
// int32 limit = GET16(tom_ram_8, 0x0008); // LIMIT
+// int32 limit = 720;
+// int32 lbufWidth = (!in24BPPMode ? limit - 1 : (limit / 2) - 1); // Zero based limit...
+//printf("[OP:xpos=%i,spos=%i,epos=%i>", xpos, startPos, endPos);
+ // This is correct, the OP line buffer is a constant size...
int32 limit = 720;
- int32 lbufWidth = (!in24BPPMode ? limit - 1 : (limit / 2) - 1); // Zero based limit...
+ int32 lbufWidth = 719;
// If the image is completely to the left or right of the line buffer, then bail.
//If in REFLECT mode, then these values are swapped! !!! FIX !!! [DONE]
clippedWidth = startPos - lbufWidth,
dataClippedWidth = phraseClippedWidth = clippedWidth / phraseWidthToPixels[depth],
startPos = lbufWidth + (clippedWidth % phraseWidthToPixels[depth]);
+//printf("<OP:spos=%i,epos=%i]", startPos, endPos);
// If the image is sitting on the line buffer left or right edge, we need to compensate
// by decreasing the image phrase width accordingly.
// uint32 lbufAddress = 0x1800 + (!in24BPPMode ? leftMargin * 2 : leftMargin * 4);
//Why does this work right when multiplying startPos by 2 (instead of 4) for 24 BPP mode?
//Is this a bug in the OP?
- uint32 lbufAddress = 0x1800 + (!in24BPPMode ? startPos * 2 : startPos * 2);
+//It's because in 24bpp mode, each pixel takes *4* bytes, instead of the usual 2.
+//Though it looks like we're doing it here no matter what...
+// uint32 lbufAddress = 0x1800 + (!in24BPPMode ? startPos * 2 : startPos * 2);
+//Let's try this:
+ uint32 lbufAddress = 0x1800 + (startPos * 2);
uint8 * currentLineBuffer = &tomRam8[lbufAddress];
// Render.
// From the docs, it is... If we want to limit here we should think of something else.
// int32 limit = GET16(tom_ram_8, 0x0008); // LIMIT
int32 limit = 720;
- int32 lbufWidth = (!in24BPPMode ? limit - 1 : (limit / 2) - 1); // Zero based limit...
+// int32 lbufWidth = (!in24BPPMode ? limit - 1 : (limit / 2) - 1); // Zero based limit...
+ int32 lbufWidth = 719; // Zero based limit...
// If the image is completely to the left or right of the line buffer, then bail.
//If in REFLECT mode, then these values are swapped! !!! FIX !!! [DONE]