uint64 p0 = OPLoadPhrase(op_pointer);
//WriteLog("\t%08X type %i\n", op_pointer, (uint8)p0 & 0x07);
op_pointer += 8;
+
+#if 1
if (scanline == TOMGetVDB() && op_start_log)
//if (scanline == 215 && op_start_log)
//if (scanline == 28 && op_start_log)
+//if (scanline == 0)
{
WriteLog("%08X --> phrase %08X %08X", op_pointer - 8, (int)(p0>>32), (int)(p0&0xFFFFFFFF));
if ((p0 & 0x07) == OBJECT_TYPE_BITMAP)
WriteLog("\n");
}
if ((p0 & 0x07) == OBJECT_TYPE_STOP)
-WriteLog(" --> List end\n");
-}//*/
+WriteLog(" --> List end\n\n");
+}
+#endif
switch ((uint8)p0 & 0x07)
{
//No, the reason this was needed is that the OP code before was wrong. Any value
//less than VDB will get written to the top line of the display!
-// if (ypos == 0)
-// ypos = TOMReadWord(0xF00046, OP) / 2; // Get the VDB value
+#if 0
+// Not so sure... Let's see what happens here...
+// No change...
+ if (ypos == 0)
+ 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)
+
uint32 height = (p0 & 0xFFC000) >> 14;
uint32 oldOPP = op_pointer - 8;
// *** BEGIN OP PROCESSOR TESTING ONLY ***
uint16 ypos = (p0 >> 3) & 0x7FF;
uint32 height = (p0 & 0xFFC000) >> 14;
uint32 oldOPP = op_pointer - 8;
+//WriteLog("OP: Scaled Object (ypos=%04X, height=%04X", ypos, height);
// *** BEGIN OP PROCESSOR TESTING ONLY ***
if (inhibit && op_start_log)
{
// OP write-backs
- uint8 remainder = p2 >> 16, vscale = p2 >> 8;
+ uint16 remainder = (p2 >> 16) & 0xFF;//, vscale = p2 >> 8;
+ uint8 /*remainder = p2 >> 16,*/ vscale = p2 >> 8;
//Actually, we should skip this object if it has a vscale of zero.
//Or do we? Not sure... Atari Karts has a few lines that look like:
// (SCALED BITMAP)
// [7 (0) x 1 @ (13, 0) (8 bpp), l: 000E82A0, p: 000E0FC0 fp: 00, fl:RELEASE, idx:00, pt:01]
// [hsc: 9A, vsc: 00, rem: 00]
// Could it be the vscale is overridden if the DWIDTH is zero? Hmm...
+//WriteLog("OP: Scaled bitmap processing (rem=%02X, vscale=%02X)...\n", remainder, vscale);//*/
if (vscale == 0)
vscale = 0x20; // OP bug??? Nope, it isn't...! Or is it?
// if ((remainder - 1) >= 0xE0) // I.e., it's <= 0
// if ((remainder >= 0xE1) || remainder == 0)// I.e., it's <= 0
// if ((remainder >= 0xE1 && remainder <= 0xFF) || remainder == 0)// I.e., it's <= 0
- if (remainder <= 0x20) // I.e., it's <= 0
+// if (remainder <= 0x20) // I.e., it's <= 1.0
+ // I.e., it's < 1.0f -> means it'll go negative when we subtract 1.0f.
+ if (remainder < 0x20)
{
uint64 data = (p0 & 0xFFFFF80000000000LL) >> 40;
uint64 dwidth = (p1 & 0xFFC0000) >> 15;
// while ((remainder - 1) >= 0xE0)
// while ((remainder >= 0xE1) || remainder == 0)
// while ((remainder >= 0xE1 && remainder <= 0xFF) || remainder == 0)
- while (remainder <= 0x20)
+// while (remainder <= 0x20)
+ while (remainder < 0x20)
{
remainder += vscale;
p2 &= ~0x0000000000FF0000LL;
p2 |= (uint64)remainder << 16;
//WriteLog("%08X%08X]\n", (uint32)(p2>>32), (uint32)(p2&0xFFFFFFFF));
- OPStorePhrase(oldOPP+16, p2);
+ OPStorePhrase(oldOPP + 16, p2);
//remainder = (uint8)(p2 >> 16), vscale = (uint8)(p2 >> 8);
//WriteLog(" [after]: rem=%02X, vscale=%02X\n", remainder, vscale);
}
+
op_pointer = (p0 & 0x000007FFFF000000LL) >> 21;
break;
}
// for use when using endian-corrected data (i.e., any of the *ReadWord functions!)
uint16 * paletteRAM16 = (uint16 *)paletteRAM;
- uint8 hscale = p2 & 0xFF;
+ uint16 hscale = p2 & 0xFF;
// Hmm. It seems that fixing the horizontal scale necessitated re-fixing this. Not sure why,
// but seems to be consistent with the vertical scaling now (and it may turn out to be wrong!)...
- uint8 horizontalRemainder = hscale; // Not sure if it starts full, but seems reasonable [It's not!]
+ uint16 horizontalRemainder = hscale; // Not sure if it starts full, but seems reasonable [It's not!]
// uint8 horizontalRemainder = 0; // Let's try zero! Seems to work! Yay! [No, it doesn't!]
int32 scaledWidthInPixels = (iwidth * phraseWidthToPixels[depth] * hscale) >> 5;
uint32 scaledPhrasePixels = (phraseWidthToPixels[depth] * hscale) >> 5;
currentLineBuffer += lbufDelta;
+/*
+The reason we subtract the horizontalRemainder *after* the test is because we had too few
+bytes for horizontalRemainder to properly recognize a negative number. But now it's 16 bits
+wide, so we could probably go back to that (as long as we make it an int16 and not a uint16!)
+*/
/* horizontalRemainder -= 0x20; // Subtract 1.0f in [3.5] fixed point format
while (horizontalRemainder & 0x80)
{
pixCount++;
pixels <<= 1;
}//*/
- while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction)
+// while (horizontalRemainder <= 0x20) // I.e., it's <= 1.0 (*before* subtraction)
+ while (horizontalRemainder < 0x20) // I.e., it's <= 1.0 (*before* subtraction)
{
horizontalRemainder += hscale;
pixCount++;
pixCount++;
pixels <<= 2;
}//*/
- while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction)
+// while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction)
+ while (horizontalRemainder < 0x20) // I.e., it's <= 1.0 (*before* subtraction)
{
horizontalRemainder += hscale;
pixCount++;
pixCount++;
pixels <<= 4;
}//*/
- while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction)
+// while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction)
+ while (horizontalRemainder < 0x20) // I.e., it's <= 0 (*before* subtraction)
{
horizontalRemainder += hscale;
pixCount++;
currentLineBuffer += lbufDelta;
- while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction)
+// while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction)
+ while (horizontalRemainder < 0x20) // I.e., it's <= 1.0 (*before* subtraction)
{
horizontalRemainder += hscale;
pixCount++;
pixCount++;
pixels <<= 16;
}//*/
- while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction)
+// while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction)
+ while (horizontalRemainder < 0x20) // I.e., it's <= 1.0 (*before* subtraction)
{
horizontalRemainder += hscale;
pixCount++;