List P = 16F84
#include <p16F84.inc>
#define led 0 ;led is on pin 0 & 0V
#define switch 0 ;switch is on pin 0 & +5V
__CONFIG 1Bh ;_CP_OFF & _PWRTE_ON & _WDT_OFF & _RC_OSC
ORG 0
SetUp BSF STATUS,RP0 ;move to bank1
CLRF TRISB ;portB all pins as output
MOVLW 01
MOVWF TRISA ;set port A,0 as input pin
BCF STATUS,RP0 ;back to bank0
CLRF PORTB ;led off
Main
BTFSS PORTA,switch ;is switch pressed?
GOTO Main2 ;no
BSF PORTB,led ;yes
GOTO Main
BCF PORTB,led ; <<<< these two instructions
GOTO Main ; <<<< will never get executed
Main2 BCF PORTB,led ;turn off led
GOTO Main
END