It seems to be a two-step process. There's the array of features that we already deciphered, which has a flag set if a "special" is on that square, and also tells where stairs, portals, treasure are. The game looks here so SOSI spell can warn players about specials. When a player actually walks on that square, it looks up the coordinates in the lists that I talked about above, and executes the correct code. There seem to be a handful of "standard" specials. The ones I found in The Cellars are text messages, spinners, teleporters, and the actual specials, like the statue of the spider god.How does the game know when the party steps on a special?
I don't know exactly how the spider god special works, but I know something about it now. The text for that special is not in memory, so it must find out where to look on disk from something that is in memory--probably the 8 bytes following the specials coordinates.
The "phantom" special on the third level of Harkyn's Castle is a case where there's a "special feature" flag set, but then the coordinates for that square are never found, so nothing happens. What's quite interesting to me is that this is probably a bug we can fix by meddling with the memory--I'm hopingthat the wrong coordinates are stored, so the two things never link up. I don't have my hopes up too high, though, since we proved there's no text stored on the disks that we haven't seen. It's possible that it's a special that simply got removed from the game, though.
After I learn as much more as I can, I'll put togther a document that explains it all as clearly as I can.