]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/op.cpp
Virtual Jaguar 2.0.0 release.
[virtualjaguar] / src / op.cpp
index 510b034b14685e479c0618fd53cc2b216009ec26..9da791b4214565cc8103c9645bb73074b9323f99 100644 (file)
@@ -318,8 +318,6 @@ void DumpFixedObject(uint64 p0, uint64 p1)
 //
 // 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)
 {
@@ -342,7 +340,7 @@ bool inhibit;
 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)
@@ -454,7 +452,8 @@ WriteLog("    --> List end\n\n");
                                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;
@@ -682,9 +681,13 @@ OP: Scaled bitmap 4x? 4bpp at 34,? hscale=80 fpix=0 data=000756E8 pitch 1 hflipp
                                        op_pointer = link;
                                break;
                        case CONDITION_SECOND_HALF_LINE:
+//Here's the ASIC code:
+//  ND4(cctrue5, newheight[2], heightl[1], heightl[0], hcb[10]);
+//which means, do the link if bit 10 of HC is set...
+
                                // This basically means branch if bit 10 of HC is set
 #warning "Unhandled condition code causes emulator to crash... !!! FIX !!!"
-                               WriteLog("OP: Unexpected CONDITION_SECOND_HALF_LINE in BRANCH object\nOP: shuting down\n");
+                               WriteLog("OP: Unexpected CONDITION_SECOND_HALF_LINE in BRANCH object\nOP: shutting down!\n");
                                LogDone();
                                exit(0);
                                break;
@@ -898,6 +901,10 @@ if (depth > 5)
 // anyway.
 // This seems to be the case (at least according to the Midsummer docs)...!
 
+// This is to test using palette zeroes instead of bit zeroes...
+// And it seems that this is wrong, index == 0 is transparent apparently... :-/
+//#define OP_USES_PALETTE_ZERO
+
        if (depth == 0)                                                                 // 1 BPP
        {
                // The LSB of flags is OPFLAG_REFLECT, so sign extend it and or 2 into it.
@@ -915,7 +922,11 @@ if (depth > 5)
                        while (i++ < 64)
                        {
                                uint8 bit = pixels >> 63;
+#ifndef OP_USES_PALETTE_ZERO
                                if (flagTRANS && bit == 0)
+#else
+                               if (flagTRANS && (paletteRAM16[index | bit] == 0))
+#endif
                                        ;       // Do nothing...
                                else
                                {
@@ -963,7 +974,11 @@ if (firstPix)
 // This only works for the palettized modes (1 - 8 BPP), since we actually have to
 // copy data from memory in 16 BPP mode (or does it? Isn't this the same as the CLUT case?)
 // No, it isn't because we read the memory in an endian safe way--this *won't* work...
+#ifndef OP_USES_PALETTE_ZERO
                                if (flagTRANS && bits == 0)
+#else
+                               if (flagTRANS && (paletteRAM16[index | bits] == 0))
+#endif
                                        ;       // Do nothing...
                                else
                                {
@@ -1003,7 +1018,11 @@ if (firstPix)
 // This only works for the palettized modes (1 - 8 BPP), since we actually have to
 // copy data from memory in 16 BPP mode (or does it? Isn't this the same as the CLUT case?)
 // No, it isn't because we read the memory in an endian safe way--this *won't* work...
+#ifndef OP_USES_PALETTE_ZERO
                                if (flagTRANS && bits == 0)
+#else
+                               if (flagTRANS && (paletteRAM16[index | bits] == 0))
+#endif
                                        ;       // Do nothing...
                                else
                                {
@@ -1044,7 +1063,14 @@ if (firstPix)
 // This only works for the palettized modes (1 - 8 BPP), since we actually have to
 // copy data from memory in 16 BPP mode (or does it? Isn't this the same as the CLUT case?)
 // No, it isn't because we read the memory in an endian safe way--this *won't* work...
+//This would seem to be problematic...
+//Because it's the palette entry being zero that makes the pixel transparent...
+//Let's try it and see.
+#ifndef OP_USES_PALETTE_ZERO
                                if (flagTRANS && bits == 0)
+#else
+                               if (flagTRANS && (paletteRAM16[bits] == 0))
+#endif
                                        ;       // Do nothing...
                                else
                                {
@@ -1087,7 +1113,10 @@ if (firstPix)
 // This only works for the palettized modes (1 - 8 BPP), since we actually have to
 // copy data from memory in 16 BPP mode (or does it? Isn't this the same as the CLUT case?)
 // No, it isn't because we read the memory in an endian safe way--it *won't* work...
-                               if (flagTRANS && (bitsLo | bitsHi) == 0)
+//This doesn't seem right... Let's try the encoded black value ($8800):
+//Apparently, CRY 0 maps to $8800...
+                               if (flagTRANS && ((bitsLo | bitsHi) == 0))
+//                             if (flagTRANS && (bitsHi == 0x88) && (bitsLo == 0x00))
                                        ;       // Do nothing...
                                else
                                {
@@ -1379,7 +1408,11 @@ if (firstPix != 0)
                {
                        uint8 bits = pixels >> 63;
 
+#ifndef OP_USES_PALETTE_ZERO
                        if (flagTRANS && bits == 0)
+#else
+                       if (flagTRANS && (paletteRAM16[index | bits] == 0))
+#endif
                                ;       // Do nothing...
                        else
                        {
@@ -1444,7 +1477,11 @@ if (firstPix != 0)
                {
                        uint8 bits = pixels >> 62;
 
+#ifndef OP_USES_PALETTE_ZERO
                        if (flagTRANS && bits == 0)
+#else
+                       if (flagTRANS && (paletteRAM16[index | bits] == 0))
+#endif
                                ;       // Do nothing...
                        else
                        {
@@ -1504,7 +1541,11 @@ if (firstPix != 0)
                {
                        uint8 bits = pixels >> 60;
 
+#ifndef OP_USES_PALETTE_ZERO
                        if (flagTRANS && bits == 0)
+#else
+                       if (flagTRANS && (paletteRAM16[index | bits] == 0))
+#endif
                                ;       // Do nothing...
                        else
                        {
@@ -1563,7 +1604,11 @@ if (firstPix)
                {
                        uint8 bits = pixels >> 56;
 
+#ifndef OP_USES_PALETTE_ZERO
                        if (flagTRANS && bits == 0)
+#else
+                       if (flagTRANS && (paletteRAM16[bits] == 0))
+#endif
                                ;       // Do nothing...
                        else
                        {
@@ -1619,7 +1664,10 @@ if (firstPix != 0)
                {
                        uint8 bitsHi = pixels >> 56, bitsLo = pixels >> 48;
 
-                       if (flagTRANS && (bitsLo | bitsHi) == 0)
+//This doesn't seem right... Let's try the encoded black value ($8800):
+//Apparently, CRY 0 maps to $8800...
+                               if (flagTRANS && ((bitsLo | bitsHi) == 0))
+//                             if (flagTRANS && (bitsHi == 0x88) && (bitsLo == 0x00))
                                ;       // Do nothing...
                        else
                        {