Ptr1,Ptr2 - Point to the sprite data for each sprite. Runlength1,Runlength2 - length of the current run for each sprite. Runtype1,Runtype2 - type of current run for each sprite, either solid or transparent. This sprite is sprite1. The lower sprite is sprite2.
Y starts here, the first scanline that is shared by both bounding boxes.
Ptr2 simply points to the beginning of sprite2. This is the main loop of the algorithm. Grab a code byte from each sprite. Here, and each time you do this in the algorithm, you need to advance the pointer in question, and skip over the added bytes. For instance if the code byte indicates a 5-pixel solid run, skip over the 5 bytes as well.