Re: Interfacing DS1302 with dsPIC33FJ128GP802
... why it works ...?
Seems you're violating some timing condition when it's not on top. Better to find a solution that's working irrespective of the position of the shift op: would be more robust wrt future changes.
PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)