When you say "crash" you mean the oscillator stops? Or the code is stuck in a loop whilst it waits for a bit to be set/clear? Just asking because the two are not the same. And am I right in thinking, it worked with the '887, but not the PIC18?
This is where a hardware debugger really helps, or the poor mans equivalent - adding macro breakpoints/indication in the software, to make a pin high, or light an LED whilst it's in a function. You can then see this, or measure the frequency/duty to see roughly how long the code is in that function/state.
First of all, strip it back - can you get the MCU to run - twiddle IO and measure it, so you know the oscillator is working. Then you work with the GPIO you want to use - check that you can both set its output, and read from it, some pins are configured as analogue by default. Then you step by step, check each of the I2C routines. Start, write etc..
It sounds arduous, but breaking it down into small simple tasks means you can methodically work through the problem over a cup of coffee rather than stare at code hoping for inspiration.
(small note: I hate I2C always have. I can get it to work on most PICs/AVRs, but avoid it if I can).