- WriteLog("\n");
- OPDumpObjectList(address + 8);
-
- // Do the sanity check after recursive call: We may have already seen this...
- // Sanity checking: If we've already visited this link, bail out!
-//disnowok: we added ourself above
-// for(uint32 i=0; i<numberOfLinks; i++)
-// {
-// if (address == objectLink[i])
-// return;
-// }
+ OPDiscoverObjects(address + 8);
+ }
+
+ if (address == link) // Ruh roh...
+ {
+ // Runaway recursive link is bad!
+ return;
+ }
+
+ address = link;
+
+ // Check to see if we've already seen this object, and add it if not
+ bool seenObject = false;
+
+ for(uint32 i=0; i<numberOfObjects; i++)
+ {
+ if (address == object[i])
+ {
+ seenObject = true;
+ break;
+ }
+ }
+
+ if (!seenObject)
+ object[numberOfObjects++] = address;
+ }
+ while (objectType != 4);
+}
+
+void OPDumpObjectList(void)
+{
+ for(uint32 i=0; i<numberOfObjects; i++)
+ {
+ uint32 address = object[i];
+
+ uint32 hi = JaguarReadLong(address + 0, OP);
+ uint32 lo = JaguarReadLong(address + 4, OP);
+ uint8 objectType = lo & 0x07;
+ uint32 link = ((hi << 11) | (lo >> 21)) & 0x3FFFF8;
+ WriteLog("%08X: %08X %08X %s", address, hi, lo, opType[objectType]);
+
+ if (objectType == 3)
+ {
+ uint16 ypos = (lo >> 3) & 0x7FF;
+ uint8 cc = (lo >> 14) & 0x07; // Proper # of bits == 3
+ WriteLog(" YPOS=%u, CC=%s, link=$%08X", ypos, ccType[cc], link);