Disconnected code

Is there any way to run code in a competition scenario that activates an autonomous program if the robot disconnects before the match ends? It could be programmed to stop once the 1:45 seconds are over since it wouldn’t be connected.
If so, would it be competition legal.

There is no way to do this. The VEX firmware is designed to stop all motors if the VEXnet connection is lost for safety reasons.