Try this;
Code:
DEFINE OSC 4
    
    ' GPIO.1 & 3 inputs, rest outputs. Use external pull-ups
    ' on GPIO.1 & 3.
    TRISIO=%00001010
    ' Internal pull-ups off, prescaler to wdt, 1:128 prescale,
    ' wakes up approx every 2.3 seconds.
    OPTION_REG=%01001111

    Low GPIO.0 ' pre-condition output for high pulsout

Loop: ' 100K external pull-up on GPIO.1, switch grounds GPIO.1
      ' when pressed
    WHILE GPIO.1 = 0    ' if button pressed, do pulsout
       CLEARWDT         ' reset WDT while in loop
       pulsout 0, 4000  ' pulsout GPIO.0
    WEND
    
    ' Note: It will wakeup about every 2.3 seconds on WDT timeout,
    ' or switch press, but doesn't pulsout unless switch is pressed.    
    @ SLEEP             ; else sleep
    ' Don't need goto here since wake up is a device reset.
    END