Your description of the logic you want to implement is very easy to do in assembly however writing code is pretty much the last step in the process. First you need to understand how your sensor inputs and control outputs work both physically and electrically. You then need to plan out the circuitry to make safe, reliabe, and functional connections to the PIC. How far along in the process are you? Share with us everything that you can and someone will help guide you along.