;=======template.asm====================================================
;code template for PIC16F84A
;-----------------------------------------------------------------------
       list    p=16f84a
       radix   hex
       #include "p16f84a.inc"
       __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
                               ;_CPO_OFF code protection off
                               ;_WDT_OFF watchdog timer off
                               ;_PWRTE_ON power-up timer on
                               ;_XT_OSC quartz osicillator
;-----------------------------------------------------------------------
;I/O
;       pin     function
;       PORTA,0 switch
;       PORTB,0 LED
;-----------------------------------------------------------------------
;memory map
label   equ     0x0D
;-----------------------------------------------------------------------
;program
       org     0x00
       goto    init

init
       bsf     STATUS,RP0      ;bank 1
       movlw   0xFF            ;PORTA as input
       movwf   TRISA
       movlw   0x00            ;PORTB as output
       movwf   TRISB
       bcf     STATUS,RP0      ;bank 0
       clrf    PORTA           ;zeroes PORTA
       clrf    PORTB           ;zeroes PORTB

start


switch
       btfss   PORTA,0         ;skip next line if switch is closed
       goto    switch

       END
;=======================================================================