First, J1 is "my" connector to a programming cable from the circuit to a PC serial port. On the 08M, P0 is used both for serial out (for programming and other serial communications) and as a general purpose output. So, 4 to 5 would be jumpered for program down-loading. If P0 were used in this circuit, the jumper would then be moved from 5 to 6. Pins 1,2, and 3 are Rx, Tx, and Common to the serial port. I generally use this on boards when I want to reprogram the chip in-place.
The logic....
When you push the button, it supplies power to the 5V regulator and to the PICAXE chip, and to P3 through a 12V-to-5V voltage divider.
The program starts by setting P1 high, turning on Q2, which turns on Q1, which latches on power to the the regulator and chip.
The program next sets P2 Low, assuring that the output to Q3 and the relay is off.
The PAUSE is to account for a small amount of on-off bounce in the switch contacts.
The IF statement looks to see if P3 is low, meaning the pushbutton of open. The timing doesn't start until the finger is off the button, otherwise the program may think it's a shut-off push.
Once P3 goes low, it sets an interrupt mask for the next high on P3.
The time interval is adjustable, set by a 0-4.5V input from R8 to the 8-bit ADC input P4.
The timing portion first reads the 8-bit voltage on P4 into variable b0.
Output P2 is set high to turn on Q3 and the relay.
The for-next loop, repeats the number times set by the variable b0
The pause within the loop sets the delay time within each loop. This constant was fine tuned to 60 seconds max, by trial and error.
At the end of the for-next loop, a jump is made to Terminate to shut off the relay by a low to P2, and the power to the circuit by a low to P1.
If the button is pushed during the timing loop, P3 goes high, the interrupt is called, and the program jumps to Terminate.
D1 and D2 are steering diodes to isolate the P3 divider from the input to the regulator when it's powered by Q1.
Hope this helps.
Ken